Thanks Stuart, I tried that package and it indeed does what i needed :) But I decided to scratch my itch anyway and dug a bit into the pkg_info code to figure out what was going on and I found the culprit: is the match_locations function in the PackageRepositoryList class that all the matches from the first repository that has some.
I changed that behaviour but that had some side effects so I modified the PkgInfo class, the patch follows. Hope this might help for future work on pkg_info. Cheers, Antonio ########################################################################## Index: usr.sbin/pkg_add/OpenBSD/PkgInfo.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v retrieving revision 1.49 diff -u -p -u -p -r1.49 PkgInfo.pm --- usr.sbin/pkg_add/OpenBSD/PkgInfo.pm 7 Oct 2017 13:23:05 -0000 1.49 +++ usr.sbin/pkg_add/OpenBSD/PkgInfo.pm 23 Nov 2019 17:45:52 -0000 @@ -597,15 +597,18 @@ sub parse_and_run $state->say("PKG_PATH=#1", $ENV{PKG_PATH} // "<undefined>") if $state->verbose; my $partial = OpenBSD::Search::PartialStem->new($state->opt('Q')); - my $r = $state->repo->match_locations($partial); - for my $pkg (sort {$a->name cmp $b->name} @$r) { - my $p = $pkg->name; - if ($state->hasanyopt('cdfMqs')) { - $self->print_info($state, $p, $pkg); - } else { - $state->say( - is_installed($p) ? "#1 (installed)" : "#1", $p); + for my $repo (@{$state->locator->default_path($state)->{l}}) { + $state->say("Repo: #1:#2", $repo->urlscheme, $repo->baseurl); + my $r = $repo->match_locations($partial); + for my $pkg (sort {$a->name cmp $b->name} @$r) { + my $p = $pkg->name; + if ($state->hasanyopt('cdfMqs')) { + $self->print_info($state, $p, $pkg); + } else { + $state->say( + is_installed($p) ? "#1 (installed)" : "#1", $p); + } } } ########################################################################## On Tue, Nov 19, 2019 at 22:53 Stuart Henderson <s...@spacehopper.org> wrote: > > On 2019-11-19, Marc Espie <es...@nerim.net> wrote: > > On Tue, Nov 19, 2019 at 12:13:37PM +0200, Dumitru Moldovan wrote: > >> On Mon, Nov 18, 2019 at 11:15:05AM +0100, Antonio Bibiano wrote: > >> > Hello, > >> > I just wanted to add to this thread that I incurred in the same > >> > issue on a fresh 6.6 installation. > >> > I also tried with a different mirror in /etc/installurl and receive > >> > the same partial response from pkg_info -Q. > >> > What makes it even more odd is that pkg_add finds the correct package. > >> > >> Thanks Antonio for double-checking this! I have also tested it on a > >> fresh installation at the time and got the same results. > >> > >> Maybe the behaviour is undefined if PKG_PATH is not set, which is fine > >> by me. But still, it's quite puzzling and against the principle of > >> least surprise. > > > > It's one of those little things that is well known, but that won't change > > until I have time to look at it, and it's definitely not a high priority > > problem right now. > > > > > > As a workaround (but also something that would be more likely to give > the results wanted than a properly-working pkg_info -Q which doesn't match > filenames inside the packages), you might like to "pkg_add pkglocatedb" > and use the "pkglocate" tool that this provides. >