Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Aug 2022 13:58:27 +0200
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        Tatsuki Makino <tatsuki_makino@hotmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: ports-mgmt/pkg: pkg query -e %#r condition doesn't match properly <PSAPR03MB5639FB7587281A570DE507F9FA9C9@PSAPR03MB5639.apcprd03
Message-ID:  <20220804115827.j42dq4zbnlqhbvey@aniel.nours.eu>
In-Reply-To: <PSAPR03MB5639AE5617E6DC8625509FAAFA9F9@PSAPR03MB5639.apcprd03.prod.outlook.com>
References:  <202208031420.273EKIij052490@nuc.oldach.net> <PSAPR03MB56391BF9DDCAC869E85B64FCFA9C9@PSAPR03MB5639.apcprd03.prod.outlook.com> <PSAPR03MB5639AE5617E6DC8625509FAAFA9F9@PSAPR03MB5639.apcprd03.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220804115827.j42dq4zbnlqhbvey>