From nobody Thu Aug 4 11:58:27 2022 X-Original-To: freebsd-ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lz6gn0SXqz4Yr65 for ; Thu, 4 Aug 2022 11:58:29 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lz6gm74y9z453v; Thu, 4 Aug 2022 11:58:28 +0000 (UTC) (envelope-from bapt@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659614309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a8+jYu1mEiKFwsWodYXSDOozfQFy4K9wrdogD3qbZ/8=; b=Zp/VKU8sNE/dpeJpiccKXtLMCZmJ6H8mM45TmrfG+ucUqrnfOsu93Jm2qwLi6tIdOcoflv F//rZuB1xTetzKpwLM57HviQc+X3cQ+2nRgmnixSHCGCcyd80GJFFupiQsP13yTS75/9hh FQxhjI38bBz/FHdtwWDI/eWx7iuC+KN8mVBFmMid3ltnwrafy0Nd+KP2Tj2KE18cpNabjK 5OkQBKxOMbXF/vf1DjAEUaeMByWw/IJ8xYBm1RfDI+wlYo1CMN2wMpF2iay6egCFsDktQS vLa+xRKcYTGhPpgDtor0SrYUXX5bM9eiTGqpogCe/bzfr1SZbOVBbELBp7AHrA== Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Lz6gm5TvYz1Dh0; Thu, 4 Aug 2022 11:58:28 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 2B1AEAF5E2; Thu, 4 Aug 2022 13:58:27 +0200 (CEST) Date: Thu, 4 Aug 2022 13:58:27 +0200 From: Baptiste Daroussin To: Tatsuki Makino Cc: freebsd-ports@freebsd.org Subject: Re: ports-mgmt/pkg: pkg query -e %#r condition doesn't match properly References: <202208031420.273EKIij052490@nuc.oldach.net> List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659614309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a8+jYu1mEiKFwsWodYXSDOozfQFy4K9wrdogD3qbZ/8=; b=Cu8+9irnLe3/KdrFNp4+M3qZ7741y9is0jCQRXwj4FsX2zbSynkHAoeW2q+hsRVYW8kqHi yUlajOq44s48FQv6+Ar/DDsn3z2iwF66XmQKz3uHtE+NC5wQb9yIWFuwIiob4ApHhFSCQH JpZE4qGo3R4V3yCbZz2nP0wHpYccGkcIP7UXBfKPjtVKjmmYcPS28exCwr3eyjOCV3igVF GuBmigadQgyiz79/wbc89SgXJJHh6+UjsGBZ3tR7TihG17lwBlQrpTjrgLesl4gYJa+Fte E4LaQ6R9SyfQt/SKHz3hu43zVsWAlBbaZeXnRH61JsWBZwbzLe63ra0I49W+Mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659614309; a=rsa-sha256; cv=none; b=EUHGt3zsgB3IoVPbtrn8okXGhg0fIfF/aFfEazN1Lv7HhbEwiBmkoNawg2NMpKiCyMtpdU 0Dxdt9JLxCj3abzbbKUu0yiIhIrbAQrvvrpiRuzPE96N3MtgURmrC0WFvJnhszsfpVnZrN 1xthMpUhaOBO4GD5/DmVA+uavk7mHxkJe+wWit1YhyZLdorWCxUJfPrSg8mHI1d/grbzOZ ItNN5SSMl9OdngvlaPz8uN9+eGFMBr1NkWHa2NOSMtzkMqXvjuXB+YUiMGSC3gu3p8bk0p cXuKyHldDDFUoLPgmB2nXt7RkUjXrqR5DUOSmJnS/mjrKYJbiAYuvN0NVgElug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Thu, Aug 04, 2022 at 04:17:49PM +0900, Tatsuki Makino wrote: > Looking at "pkg shell .dump | grep \ deps\ " results, it seems that origin without @flavor is not unique. > However, ports that use FLAVORS are modified to make the PKGNAME unique. > > So, the following patch is applied and it seems to be working properly. > The commands used in the tests are as follows. > > pkg query -e "%#r > 2" "%n:%#r" | sort -t : -k 2nr -k 1 > > If someone has already repaired it, forget it :) > > Regards. > > --- src/query.c.orig 2022-08-03 07:37:06 UTC > +++ src/query.c > @@ -557,7 +557,7 @@ format_sql_condition(const char *str, xstring *sqlcond > fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.package_id=p.id)", sqlop); > break; > case 'r': > - fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.origin=p.origin)", sqlop); > + fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.name=p.name)", sqlop); > break; > case 'C': > fprintf(sqlcond->fp, "(SELECT %s FROM pkg_categories AS d WHERE d.package_id=p.id)", sqlop); > > Good catch, thanks, pushed in the repo: https://github.com/freebsd/pkg/commit/a1f6f620b4671d924f5fad3f24c2d7abc3b229cb Will be in the next release of pkg!! Best regards, Bapt