Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jan 2000 18:34:19 +0000
From:      Mark Ovens <mark@ukug.uk.freebsd.org>
To:        Jonathon McKitrick <jcm@dogma.freebsd-uk.eu.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: possible bug in pkg_version
Message-ID:  <20000120183419.A340@marder-1>
In-Reply-To: <Pine.BSF.4.21.0001201653390.6243-100000@dogma.freebsd-uk.eu.org>
References:  <Pine.BSF.4.21.0001201653390.6243-100000@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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