From dm@home.dinoex.sub.org  Mon Apr 29 09:48:23 2002
Return-Path: <dm@home.dinoex.sub.org>
Received: from net2.dinoex.sub.org (net2.dinoex.de [212.184.201.182])
	by hub.freebsd.org (Postfix) with ESMTP id E40A537B426
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Apr 2002 09:47:41 -0700 (PDT)
Received: from home.dinoex.sub.org (home [217.6.200.196])
	by net2.dinoex.sub.org (8.12.3/8.12.3) with ESMTP id g3TGlOat026309
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Apr 2002 18:47:25 +0200 (CEST)
	(envelope-from dm@home.dinoex.sub.org)
Received: (from dm@localhost)
	by home.dinoex.sub.org (8.12.3/8.12.2/Submit) id g3TGlN1H097092;
	Mon, 29 Apr 2002 18:47:23 +0200 (CEST)
	(envelope-from dm)
Message-Id: <200204291647.g3TGlN1H097092@home.dinoex.sub.org>
Date: Mon, 29 Apr 2002 18:47:23 +0200 (CEST)
From: dirk.meyer@dinoex.sub.org
Reply-To: dirk.meyer@dinoex.sub.org
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pkg_info broken with filenames
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         37571
>Category:       bin
>Synopsis:       pkg_info broken with filenames
>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:   Mon Apr 29 09:50:01 PDT 2002
>Closed-Date:    Thu May 02 06:10:06 PDT 2002
>Last-Modified:  Thu May 02 06:10:06 PDT 2002
>Originator:     Dirk Meyer
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
privat
>Environment:
System: FreeBSD 4.5-STABLE i386

>Description:

	pkg_info cant read any information from
	package-files supplied on the commandline.

	This worked fine in older releases of FreeBSD.

>How-To-Repeat:

# cd /src
# pkg_info /src/packages/All/gconf-1.0.9.tgz
pkg_info: can't find package `gconf-1.0.9.tgz' installed or in a file!
# ls -l /src/packages/All/gconf-1.0.9.tgz
-rw-r--r--  1 root  wheel  706765 Apr 19 22:39 /src/packages/All/gconf-1.0.9.tgz
# cd /src/packages/All/
# pkg_info /src/packages/All/gconf-1.0.9.tgz
Information for gconf-1.0.9.tgz:

[....]

>Fix:
	preserve pathname in pkg_info.
	or cd into the specified directory.

>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@ringlet.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/37571: pkg_info broken with filenames
Date: Tue, 30 Apr 2002 10:27:07 +0300

 Forwarding this to bug-followup@, so that it is added to the audit trail..
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 Hey, out there - is it *you* reading me, or is it someone else?
 
 ----- Forwarded message from Peter Sanchez <fut0n@linuxforlesbians.org> -----
 
 Date: Mon, 29 Apr 2002 16:13:14 -0700
 From: Peter Sanchez <fut0n@linuxforlesbians.org>
 To: freebsd-bugs@freebsd.org
 Subject: [fut0n@linuxforlesbians.org: Re: bin/37571: pkg_info broken with filenames]
 User-Agent: Mutt/1.2.5i
 List-ID: <freebsd-bugs.FreeBSD.ORG>
 List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
 List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
 List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-bugs>
 List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-bugs>
 
 Here is a working patch. It also fixes a bug that was discovered when
 using full paths to packages that dont exist, but the actual package is
 installed. example, pkg_info //////epic4-1.0.
 
 I didnt write this patch, It was written by Will Carrel
 (william.a@carrel.org). 
 
 --- usr.sbin/pkg_install/info/main.c    Mon Apr 29 15:55:00 2002
 +++ usr.sbin/pkg_install/info/main.c.new        Mon Apr 29 15:49:00 2002
 @@ -193,6 +193,7 @@
         if (MatchType != MATCH_REGEX)
             while ((pkgs_split = strrchr(*argv, (int)'/')) != NULL) {
                 *pkgs_split++;
 +
                 /*
                  * If character after the '/' is alphanumeric or shell
                  * metachar, then we've found the package name.
                  * Otherwise
 @@ -201,7 +202,7 @@
                  */
                 if (isalpha(*pkgs_split) || ((MatchType == MATCH_GLOB) && \
                     strpbrk(pkgs_split, "*?[]") != NULL)) {
 -                   /**argv = pkgs_split;*/
 +
                     break;
                 }
             }
 
 --- usr.sbin/pkg_install/info/perform.c Mon Apr 29 15:55:06 2002
 +++ usr.sbin/pkg_install/info/perform.c.new     Mon Apr 29 15:49:00 2002
 @@ -142,8 +142,11 @@
             goto bail;
         }
      }
 -    /* It's not an ininstalled package, try and find it among the installed */
 -    else {
 +    /* 
 +     * It's not an ininstalled package, try and find it among the installed 
 +     * so long as it doesn't have a / in it.
 +     */
 +    else if (strchr(pkg,(int)'/') == NULL) {
         sprintf(log_dir, "%s/%s", LOG_DIR, pkg);
         if (!fexists(log_dir)) {
             warnx("can't find package `%s' installed or in a file!",
 pkg);
 @@ -154,6 +157,11 @@
             return 1;
         }
         installed = TRUE;
 +    }
 +    /* Tried everywhere that makes sense, found nothing, must not exist */
 +    else {
 +        warnx("can't find package `%s' in a file!", pkg);
 +       return 1;
      }
  
      /* Suck in the contents list */
 
 
 I have tested it and it works very well.
 
 Peter
 
 On Mon, Apr 29, 2002 at 06:47:23PM +0200, dirk.meyer@dinoex.sub.org wrote:
 > 
 > >Number:         37571
 > >Category:       bin
 > >Synopsis:       pkg_info broken with filenames
 > >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:   Mon Apr 29 09:50:01 PDT 2002
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Dirk Meyer
 > >Release:        FreeBSD 4.5-STABLE i386
 > >Organization:
 > privat
 > >Environment:
 > System: FreeBSD 4.5-STABLE i386
 > 
 > >Description:
 > 
 > 	pkg_info cant read any information from
 > 	package-files supplied on the commandline.
 > 
 > 	This worked fine in older releases of FreeBSD.
 > 
 > >How-To-Repeat:
 > 
 > # cd /src
 > # pkg_info /src/packages/All/gconf-1.0.9.tgz
 > pkg_info: can't find package `gconf-1.0.9.tgz' installed or in a file!
 > # ls -l /src/packages/All/gconf-1.0.9.tgz
 > -rw-r--r--  1 root  wheel  706765 Apr 19 22:39 /src/packages/All/gconf-1.0.9.tgz
 > # cd /src/packages/All/
 > # pkg_info /src/packages/All/gconf-1.0.9.tgz
 > Information for gconf-1.0.9.tgz:
 > 
 > [....]
 > 
 > >Fix:
 > 	preserve pathname in pkg_info.
 > 	or cd into the specified directory.
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 
 -- 
 Peter Sanchez			|	"The ability to read is what
  - pjs@linuxforlesbians.org	|	 distinguishes Unix users from
  - www.linuxforlesbians.org	|	 those of more popular platforms."
  - FreeBSD or DIE		|			- John Lasser
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
 
 
 ----- End forwarded message -----
State-Changed-From-To: open->closed 
State-Changed-By: sobomax 
State-Changed-When: Thu May 2 06:09:46 PDT 2002 
State-Changed-Why:  
I've committed a fix to -current and will MFC it soon. Thank you for reporting! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37571 
>Unformatted:
