Bug 32603

Summary: pkg_info fails to find installed packages in some cases
Product: Base System Reporter: Mark Stosberg <mark>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Mark Stosberg 2001-12-08 14:20:01 UTC
Hello, I just noticed that depending on which directory I am in when I run pkg_info, I can get different results, in some cases failing to notice installed packages.

How-To-Repeat: $ cd ~mark
$ pkg_info python* 
[ 2 packages found ]
$cd /usr/ports/lang
$ pkg_info python*
 pkg_info: can't find package `python' installed or in a file!
pkg_info: can't find package `python+ipv6' installed or in a file!
pkg_info: can't find package `python-doc-html' installed or in a file!
pkg_info: can't find package `python-doc-pdf-a4' installed or in a file!
pkg_info: can't find package `python-doc-pdf-letter' installed or in a file!
pkg_info: can't find package `python-doc-postscript-a4' installed or in a file!
pkg_info: can't find package `python-doc-postscript-letter' installed or in a file!
pkg_info: can't find package `python15' installed or in a file!
pkg_info: can't find package `python20' installed or in a file!
########################################

It appears that pkg_info finding all the files named "python" in that directory, but short-circuiting before it also checks for installing packages with that name. My expectation was that it would return the information about the installed packages in either case.
Comment 1 des 2001-12-09 13:06:55 UTC
Mark Stosberg <mark@summersault.com> writes:
> $cd /usr/ports/lang
> $ pkg_info python*

When you do this, your shell expands "python*" to the list of files
and directories in the current directory whose names begins with
"python".  This is not pkg_info's doing; pkg_info simply looks in
/var/db/pkg for directories whose names match one of its command-line
arguments.

If you use zsh, you can add the following line to your .zshrc to teach
zsh how to perform argument expansion for pkg_info:

compctl -g '/var/db/pkg/*(/:t)' pkg_info pkg_delete

With this, when you press TAB or ^D on a command line that begins with
"pkg_info" or "pkg_delete" followed by a space, zsh will look for
completions in /var/db/pkg instead of the current directory.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org
Comment 2 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2001-12-09 13:07:30 UTC
State Changed
From-To: open->closed

User error.