From owner-freebsd-questions Thu Jan 20 10:47:38 2000 Delivered-To: freebsd-questions@freebsd.org Received: from monsoon.mail.pipex.net (monsoon.mail.pipex.net [158.43.128.69]) by hub.freebsd.org (Postfix) with SMTP id 80C761504B for ; Thu, 20 Jan 2000 10:47:20 -0800 (PST) (envelope-from mark@dogma.freebsd-uk.eu.org) Received: (qmail 26339 invoked from network); 20 Jan 2000 18:47:13 -0000 Received: from userbr12.uk.uudial.com (HELO marder-1.) (62.188.146.205) by smtp.dial.pipex.com with SMTP; 20 Jan 2000 18:47:13 -0000 Received: (from mark@localhost) by marder-1. (8.9.3/8.9.3) id SAA01598; Thu, 20 Jan 2000 18:34:19 GMT (envelope-from mark) Date: Thu, 20 Jan 2000 18:34:19 +0000 From: Mark Ovens To: Jonathon McKitrick Cc: freebsd-questions@freebsd.org Subject: Re: possible bug in pkg_version Message-ID: <20000120183419.A340@marder-1> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jan 20, 2000 at 04:57:34PM +0000, Jonathon McKitrick wrote: > > I would have fixed this myself but i found out it is Perl, not C, and > i also have too much to do today (: > > I used pkg_info -c to produce a script for updating ports. > > Anyway, when outputting the path to a package that is 'unknown in > index', the path is the path of the package previously processed. For > example, after showing the info, the pathname is obviously the path to > mc (/usr/ports/misc/mc). The next entry is mergemaster. While the > command to update is correct, the script outputs 'cd > /usr/ports/misc/mc' and attempts to make megermaster from that > location, which obviously will not work. Has anyone else seen this? I > just cvsupped today and it hasn't been fixed, if it truly is a bug. > Yes, it's a bug. I spotted this when Nik first added the ``-c'' option. I e-mailed him about it, he sent me a patch, then I enhanced Nik's fix. This was when pkg_version was in the ports. I thought Nik had fixed it when it became part of the base system, obviously not. Below is an e-mail I sent to Nik. It includes all the relevant info to fix it (I don't have time to make a proper diff against the current version - sorry). HTH On Thu, Nov 04, 1999 at 09:26:13PM +0000, Mark Ovens wrote: > On Thu, Nov 04, 1999 at 05:42:59PM +0000, Nik Clayton wrote: > > On Tue, Nov 02, 1999 at 08:17:21PM +0000, Mark Ovens wrote: > > > I've applied your patches to pkg_version(1) but there seems to be > > > a bug in the ``-c'' option. If a pkg doesn't appear in /usr/ports/INDEX > > > then pkg_version(1) appears to be getting the commands mixed up > > > with the previous package. > > > > I can't duplicate this on my live system, which is a touch fragile > > at the moment. However, can you try this fix for me, and let me > > know if it works for you? > > > > Go to line 257, you should be at a block of code that looks like > > > > else { > > $versionCode = "?"; > > $Comment = "unknown in index"; > > } > > > > Can you change that, and add this line somewhere in the "else" > > block. > > > > $packagePath = $indexPackages{$packageName}{'path'}; > > > > OK, this sort of worked: > > > # > # xview-lib > # unknown in index > # > cd > make > pkg_delete -f xview-lib-3.2.1 > make install > > I've made my own change that produces this: > > > # > # xview-lib > # unknown in index > # > pkg_delete -f xview-lib-3.2.1 > > which is perhaps more accurate? > > The diff for it is below (apply to pkg_version *without* the > one-liner you suggested). > > NOTE! The limit of my perl programming has, up to now, been the > ubiquitous "Hello, world" so I make no claims about my patch's > respect for style(9), I just worked out what everything was doing > and changed it :) > > > *** /usr/local/bin/pkg_version.safe Thu Nov 4 21:16:30 1999 > --- /usr/local/bin/pkg_version Thu Nov 4 21:15:32 1999 > *************** > *** 252,264 **** > $Comment = "Comparison failed"; > } > } > } > else { > $versionCode = "?"; > $Comment = "unknown in index"; > - } > > ! write; > } > > exit 0; > --- 252,267 ---- > $Comment = "Comparison failed"; > } > } > + > + write; > } > else { > $versionCode = "?"; > $Comment = "unknown in index"; > > ! $~ = "NOEXIST_COMMANDS" if $ShowCommandsFlag; > ! write; > ! } > } > > exit 0; > *************** > *** 299,304 **** > --- 302,323 ---- > pkg_delete -f @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > $packageNameVer > make install > + > + . > + ; > + > + # Report that includes commands to update program (-c flag) > + format NOEXIST_COMMANDS = > + @< > + $CommentChar > + @< @<<<<<<<<<<<<<<<<<<<<<<<< > + $CommentChar, $packageName > + @< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > + $CommentChar, $Comment > + @< > + $CommentChar > + pkg_delete -f @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > + $packageNameVer > > . > ; > > > This should get rid of the problem. I'm not sure whether better behaviour > > might be to just ignore entries that aren't in INDEX -- particularly as it > > will soon be possible to have packages installed that aren't part of the > > ports system (specifically, the docs). > > > > Maybe, but it should at least report their existence. > > > N > > -- > > A different "distribution" of Linux is really a different operating system. > > They just refuse to call it that because it's bad press. But that's what > > the shoe fits. > > -- Tom Christiansen, <199910211639.KAA18701@jhereg.perl.com> > > -- > STATE-OF-THE-ART: Any computer you can't afford. > OBSOLETE: Any computer you own. > ________________________________________________________________ > FreeBSD - The Power To Serve http://www.freebsd.org > My Webpage http://ukug.uk.freebsd.org/~mark/ > mailto:mark@ukug.uk.freebsd.org http://www.radan.com > > -=> jm <=- > > "The light that burns twice as bright burns half as long, and you have > burned so very, very brightly." > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- "there's a long-standing bug relating to the x86 architecture that allows you to install Windows too" -Matthew D. Fuller ________________________________________________________________ FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://ukug.uk.freebsd.org/~mark/ mailto:mark@ukug.uk.freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message