On 12/9/24 7:58 AM, Maxim wrote:
> The FAQ page [FAQ15] suggests to use "pkg_info -Q" to search the
> collection of pre-compiled packages. When I search for "tcl",
> I get a few "nextcloud" packages only, but no Tcl:
>
> $ pkg_info -v -Q tcl
I've been using lynx instead:
lynx --dump https://cdn.openbsd.org/pub/OpenBSD/7.6/packages/amd64/ \
| grep tcl
> PKG_PATH=<undefined>
> nextcloud-27.1.11p0
> nextcloud-28.0.11
> nextcloud-28.0.12
> nextcloud-29.0.8
> nextcloud-29.0.9
>
> At first I thought it was a bug. Then I read in pkg_info(1) that
> the flag -Q makes it "show the names of all packages in the *first*
> repository of the package search path" and that passing the flag
> -a makes it search *all* repositories instead.
>
> Indeed, now I can find Tcl:
>
> $ pkg_info -a -Q tcl | grep ^tcl | head -n 3
> tcl-8.5.19p6
> tcl-8.6.13
> tcl-snmptools-1.0p2
>
> It's problem #1. I find the FAQ page instructions misleading.
> Assuming pkg_info works as intended, shall the page be updated
> to include the -a flag, for example so?--
>
> --- faq/faq15.html
> +++ faq/faq15.html
> @@ -147 +147 @@ architectures.
> -To search for any given package name, use the <code>-Q</code> flag of
> +To search for any given package name, use the <code>-aQ</code> flags of
> @@ -151 +151 @@ To search for any given package name, use the <code>-Q
> -$ <b>pkg_info -Q unzip</b>
> +$ <b>pkg_info -aQ unzip</b>
>
> * * *
>
> I couldn't find what is a repository (in the context of the pkg_info(1)
> man page), nor how they might be set up. I assume it's related to
> installurl(5) and PKG_PATH env. var.
>
> I haven't set or changed PKG_PATH. On the mirror that my system uses,
> at <https://cdn.openbsd.org/pub/OpenBSD/7.6/> there are two directories:
> packages and packages-stable. I assume they are the "repositories" and
> they both form a default search path, where -stable comes first. The
> -stable contains the aforementioned nextcloud packages, hence matching
> the "tcl" search substring.
>
> If so, that description of -Q (show names in the first repository)
> doesn't match the behaviour of "pkg_info -Q", given the first repository
> contains no match for the search substring. Take this example:
>
> $ pkg_info -Q unzip
> lunzip-1.14p0
> unzip-6.0p17
> unzip-6.0p17-iconv
>
> $ pkg_info -aQ unzip
> lunzip-1.14p0
> unzip-6.0p17
> unzip-6.0p17-iconv
>
> There are no packages in -stable that match substring "unzip",
> so (I assume) the search carries on to the second repository
> in the search path, finds and returns something, then stops.
>
> It's problem #2. I don't know whether it's an intended behaviour
> to return names from the first *matched* repository. However,
> the actual behaviour and the man page subtly disagree here.
> I think it should be corrected in one place or another.
>
> * * *
>
> Overall it was a confusing user experience for me. I wanted to
> make a simple substring search of all available packages.
> "pkg_info -Q" is there to do it. However, inconsistency
> between the FAQ page, man page, and the actual pkg_info behaviour
> misled and confused me for a while. I also wonder why -aQ is
> a special case rather than be included in -Q by default.
>
> (Running on OpenBSD 7.6-stable/amd64.)
>
> [FAQ15]: https://www.openbsd.org/faq/faq15.html#PkgFind
No comments:
Post a Comment