Reference forum starts at: https://forums.freebsd.org/threads/pkg-2-0-0-problems.96540/page-4#post-687722 Using 14.2R and the 'latest' repository, using the pkg alias: prime-origins: "query -e '%a = 0' '%o' | sort -u", as defined in /usr/local/etc/pkg.conf introduces a pipe; it seems for the first time. Related commits: https://github.com/freebsd/pkg/commit/e52fcfac6b1a02b046da36b1d324fb84e5a00bb1 https://github.com/freebsd/pkg/commit/cce9724f190a1dbedac66cbdac2c1031c22cb864 The implementation of the pipe fails to work using pkg(8) 1.21.3 and, confirmed in the forum, for 2.0.4. The command sequence below details the unexpected empty result of pkg prim-origins and its likely cause in the underlying query by using debug level 4. Also shown that using the previous non-pipe variant of the alias and uapplying the pipe externally gets the exepected result. An empty line was added in the debug output to indicate the first immediate occurrence in a 'LEFT JOIN'. --- [0-0] # pkg -v 1.21.3 [1-0] # pkg -vv | sed -n -e '/DEBUG/ p' -e '/^Repositories:/,$ p' DBG(1)[2298]> PkgConfig: loading repositories in /etc/pkg/ DBG(1)[2298]> PKgConfig: loading /etc/pkg//FreeBSD.conf DBG(1)[2298]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2298]> PkgConfig: parsing repository object FreeBSD DBG(1)[2298]> PkgConfig: loading repositories in /usr/local/etc/pkg/repos/ DBG(1)[2298]> PKgConfig: loading /usr/local/etc/pkg/repos//FreeBSD.conf DBG(1)[2298]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2298]> PkgConfig: overwriting repository FreeBSD DBG(1)[2298]> PkgConfig: parsing repository object FreeBSD DBG(1)[2298]> PKgConfig: loading /usr/local/etc/pkg/repos//kmods.conf DBG(1)[2298]> PkgConfig: parsing key 'FreeBSD-kmods' DBG(1)[2298]> PkgConfig: parsing repository object FreeBSD-kmods DEBUG_SCRIPTS = false; DEBUG_LEVEL = 4; Repositories: FreeBSD: { url : "pkg+https://pkg.freebsd.org/FreeBSD:14:amd64/latest", enabled : yes, priority : 0, mirror_type : "SRV", signature_type : "FINGERPRINTS", fingerprints : "/usr/share/keys/pkg" } FreeBSD-kmods: { url : "pkg+https://pkg.freebsd.org/FreeBSD:14:amd64/kmods_latest_2", enabled : yes, priority : 0, mirror_type : "SRV", signature_type : "FINGERPRINTS", fingerprints : "/usr/share/keys/pkg" } [2-0] # pkg alias prime-origins DBG(1)[2301]> PkgConfig: loading repositories in /etc/pkg/ DBG(1)[2301]> PKgConfig: loading /etc/pkg//FreeBSD.conf DBG(1)[2301]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2301]> PkgConfig: parsing repository object FreeBSD DBG(1)[2301]> PkgConfig: loading repositories in /usr/local/etc/pkg/repos/ DBG(1)[2301]> PKgConfig: loading /usr/local/etc/pkg/repos//FreeBSD.conf DBG(1)[2301]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2301]> PkgConfig: overwriting repository FreeBSD DBG(1)[2301]> PkgConfig: parsing repository object FreeBSD DBG(1)[2301]> PKgConfig: loading /usr/local/etc/pkg/repos//kmods.conf DBG(1)[2301]> PkgConfig: parsing key 'FreeBSD-kmods' DBG(1)[2301]> PkgConfig: parsing repository object FreeBSD-kmods prime-origins 'query -e '%a = 0' '%o' | sort -u' [3-0] # pkg prime-origins DBG(1)[2305]> PkgConfig: loading repositories in /etc/pkg/ DBG(1)[2305]> PKgConfig: loading /etc/pkg//FreeBSD.conf DBG(1)[2305]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2305]> PkgConfig: parsing repository object FreeBSD DBG(1)[2305]> PkgConfig: loading repositories in /usr/local/etc/pkg/repos/ DBG(1)[2305]> PKgConfig: loading /usr/local/etc/pkg/repos//FreeBSD.conf DBG(1)[2305]> PkgConfig: parsing key 'FreeBSD' DBG(1)[2305]> PkgConfig: overwriting repository FreeBSD DBG(1)[2305]> PkgConfig: parsing repository object FreeBSD DBG(1)[2305]> PKgConfig: loading /usr/local/etc/pkg/repos//kmods.conf DBG(1)[2305]> PkgConfig: parsing key 'FreeBSD-kmods' DBG(1)[2305]> PkgConfig: parsing repository object FreeBSD-kmods DBG(4)[2305]> Pkgdb: running: 'PRAGMA user_version;' DBG(4)[2305]> Pkgdb: executing 'PRAGMA foreign_keys = ON;' DBG(4)[2305]> Pkgdb: executing 'PRAGMA mmap_size=268435456;' DBG(4)[2305]> Pkgdb: running: 'WITH flavors AS (SELECT package_id, value.annotation AS flavor FROM pkg_annotation LEFT JOIN annotation tag ON pkg_annotation.tag_id = tag.annotation_id LEFT JOIN annotation value ON pkg_annotation.value_id = value.annotation_id WHERE tag.annotation = 'flavor') SELECT DISTINCT(p.id), origin, p.name, p.name as uniqueid, version, comment, desc, message, arch, maintainer, www, prefix, flatsize, licenselogic, automatic, locked, time, manifestdigest, vital FROM packages AS p LEFT JOIN pkg_categories ON p.id = pkg_categories.package_id LEFT JOIN categories ON categories.id = pkg_categories.category_id LEFT JOIN flavors ON flavors.package_id = p.id WHERE (p.name = '|' COLLATE NOCASE OR p.name || '-' || version = '|' COLLATE NOCASE) AND (automatic=0) ORDER BY p.name;' DBG(4)[2305]> Pkgdb: running: 'WITH flavors AS (SELECT package_id, value.annotation AS flavor FROM pkg_annotation LEFT JOIN annotation tag ON pkg_annotation.tag_id = tag.annotation_id LEFT JOIN annotation value ON pkg_annotation.value_id = value.annotation_id WHERE tag.annotation = 'flavor') SELECT DISTINCT(p.id), origin, p.name, p.name as uniqueid, version, comment, desc, message, arch, maintainer, www, prefix, flatsize, licenselogic, automatic, locked, time, manifestdigest, vital FROM packages AS p LEFT JOIN pkg_categories ON p.id = pkg_categories.package_id LEFT JOIN categories ON categories.id = pkg_categories.category_id LEFT JOIN flavors ON flavors.package_id = p.id WHERE (p.name = 'sort' COLLATE NOCASE OR p.name || '-' || version = 'sort' COLLATE NOCASE) AND (automatic=0) ORDER BY p.name;' DBG(4)[2305]> Pkgdb: running: 'WITH flavors AS (SELECT package_id, value.annotation AS flavor FROM pkg_annotation LEFT JOIN annotation tag ON pkg_annotation.tag_id = tag.annotation_id LEFT JOIN annotation value ON pkg_annotation.value_id = value.annotation_id WHERE tag.annotation = 'flavor') SELECT DISTINCT(p.id), origin, p.name, p.name as uniqueid, version, comment, desc, message, arch, maintainer, www, prefix, flatsize, licenselogic, automatic, locked, time, manifestdigest, vital FROM packages AS p LEFT JOIN pkg_categories ON p.id = pkg_categories.package_id LEFT JOIN categories ON categories.id = pkg_categories.category_id LEFT JOIN flavors ON flavors.package_id = p.id WHERE (p.name = '-u' COLLATE NOCASE OR p.name || '-' || version = '-u' COLLATE NOCASE) AND (automatic=0) ORDER BY p.name;' [4->1<] # --- Combining the 'core' of prime-origins with the pipe used outside of the alias works fine: [20-0] # pkg alias ppp ppp 'query -e '%a = 0' '%o'' [21-0] # pkg ppp | sort -u misc/freebsd-doc-nl <snap> x11/xorg [22-0] #