Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Apr 2002 00:30:02 -0700 (PDT)
From:      Peter Pentchev <roam@ringlet.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/37571: pkg_info broken with filenames
Message-ID:  <200204300730.g3U7U2J36776@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/37571; it has been noted by GNATS.

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

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204300730.g3U7U2J36776>