From nobody@FreeBSD.org  Sat Dec  8 06:10:54 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id E554E37B417
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  8 Dec 2001 06:10:53 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fB8EArC42735;
	Sat, 8 Dec 2001 06:10:53 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112081410.fB8EArC42735@freefall.freebsd.org>
Date: Sat, 8 Dec 2001 06:10:53 -0800 (PST)
From: Mark Stosberg <mark@summersault.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pkg_info fails to find installed packages in some cases
X-Send-Pr-Version: www-1.0

>Number:         32603
>Category:       bin
>Synopsis:       pkg_info fails to find installed packages in some cases
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 08 06:20:01 PST 2001
>Closed-Date:    Sun Dec 9 05:07:30 PST 2001
>Last-Modified:  Sun Dec  9 05:10:00 PST 2001
>Originator:     Mark Stosberg
>Release:        4.4
>Organization:
>Environment:
FreeBSD asana.dhis.org 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Tue Sep 18 11:57:08 PDT 2001     murray@builder.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386
>Description:
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. 
>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Sun Dec 9 05:07:30 PST 2001 
State-Changed-Why:  
User error. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32603 

From: Dag-Erling Smorgrav <des@ofug.org>
To: Mark Stosberg <mark@summersault.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/32603: pkg_info fails to find installed packages in some cases
Date: 09 Dec 2001 14:06:55 +0100

 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
>Unformatted:
