From owner-freebsd-bugs Mon Apr 29 15: 6:23 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from sushi.linuxforlesbians.org (bgp01357202bgs.albqrq01.nm.comcast.net [68.35.149.200]) by hub.freebsd.org (Postfix) with ESMTP id DDDB537B417 for ; Mon, 29 Apr 2002 15:06:14 -0700 (PDT) Received: by sushi.linuxforlesbians.org (Postfix, from userid 1001) id 0353419D8; Mon, 29 Apr 2002 16:13:14 -0700 (MST) Date: Mon, 29 Apr 2002 16:13:14 -0700 From: Peter Sanchez To: freebsd-bugs@freebsd.org Subject: [fut0n@linuxforlesbians.org: Re: bin/37571: pkg_info broken with filenames] Message-ID: <20020429161314.A28072@sushi.linuxforlesbians.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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