Bug 233304 - ports-mgmt/pkg info -q package doesn't work
Summary: ports-mgmt/pkg info -q package doesn't work
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-18 23:03 UTC by freebsd
Modified: 2019-08-15 05:18 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (pkg)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description freebsd 2018-11-18 23:03:15 UTC
pkg info -q -a 
  gives a list of all installed packages, without descriptions (correct)
pkg info bash
  gives full info for whichever version of bash is installed
pkg info -q bash
  shows nothing
  it should show full version of installed package, as in the -1 -a output
Comment 1 Walter Schwarzenfeld freebsd_triage 2019-08-14 17:12:02 UTC
pkg info -q can used like

pkg info -q > packagelist.txt.
Comment 2 freebsd 2019-08-14 18:15:01 UTC
I am reopening this because:

pkg help info shows:
       pkg info [-AbBDdefIklOpqRrs] [-Cgix] pkg-name

That means one should be able to give:
  pkg info -q bash
or 
  pkg info -q bash-4.4.23_1

Neither of which works.

While one can clearly do
  pkg info -q | grep bash
to get the desired result, either the pkg command is not working as documented and needs fixing, or the documentation needs to be fixed to reflect how the command actually works.
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-08-14 22:47:49 UTC
It works in combination with other switches:

pkg info -qo firefox
www/firefox

pkg info -qR firefox
displays the full Manifest

pkg info -qf firefox

the normal pkg info firefox output
Comment 4 freebsd 2019-08-15 05:18:38 UTC
> It works in combination with other switches:
>
> pkg info -qo firefox
> www/firefox

In that case, it *should* work by itself, as documented.

It seems rather bizarre behavior in terms of code to have it work in combination with other flags with a filename argument, but not alone; yet work alone with no filename argument.

It looks to me like the query_flags will be empty with only -q present, as it is taken out with the "quiet" flag, and pkgdb_it_next probably does not return EPKG_OK (about line 448 in info.c).