Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Apr 2001 14:13:16 -0700
From:      bmah@FreeBSD.org (Bruce A. Mah)
To:        "Akinori MUSHA" <knu@iDaemons.org>
Cc:        "Bruce A. Mah" <bmah@FreeBSD.org>, Kris Kennaway <kris@obsecurity.org>, "David O'Brien" <obrien@FreeBSD.org>, Chris Faulhaber <jedgar@fxp.org>, freebsd-ports@FreeBSD.org
Subject:   Re: cvs commit: ports/editors/vim6 Makefile distinfo pkg-plist 
Message-ID:  <200104192113.f3JLDGj63092@bmah-freebsd-0.cisco.com>
In-Reply-To: <864rvkd47m.wl@archon.local.idaemons.org> 
References:  <200104111956.f3BJukl93003@freefall.freebsd.org> <20010419140501.A253@jive.44bsd.net> <8666g0d8ws.wl@archon.local.idaemons.org> <20010419122255.B29435@dragon.nuxi.com> <20010419123216.A53260@xor.obsecurity.org> <200104191955.f3JJtQV60074@bmah-freebsd-0.cisco.com> <864rvkd47m.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--==_Exmh_-120246284P
Content-Type: text/plain; charset=us-ascii

[moving to -ports]

If memory serves me right, "Akinori MUSHA" wrote:
> At Thu, 19 Apr 2001 12:55:26 -0700,
> Bruce A. Mah <bmah@FreeBSD.org> wrote:
> > I suspect we might need to tweak the comparison algorithm a bit.  And 
> > it's not entirely clear to me what it should be either, even though knu 
> > and I just finished reworking it.
> 
> D'oh, I've just found pkg_version's bug!!  It thinks 1.0a is smaller
> than 1.0!

Hmmm...yes, that's wrong, even though "1.0a" isn't technically allowed. 
(I wonder if the Porters Handbook might need some revision.)

> I am sorry I didn't look into and check your modification over my code
> carefully, but why did you modify the test??  Apparently the test I
> originally wrote had been modified incorrectly and that made
> pkg_version not conform to what the Handbook says.

Well, geez, it's not like I *tried* to break the bloody damn thing.  :-(
There are some pretty strange corner cases, and, I know you're aware of 
this, the syntax of software package version numbers is not well 
defined.  When you start mixing letters and digits, it's exceptionally 
messy.

pkg_version doesn't handle the 6.0aa > 6.0z case, and it'd be pretty 
hard to make it do this without making a bunch of assumptions about the 
semantics of the characters in the version numbers.  You and I differ 
on that point, I believe.

[snip]

> Unfortunately, I couldn't find an easy hotfix against the stock
> CompareNumbers() routine, as it no longer takes account of various
> sequences and combinations of numbers and alphabets in a version
> component.

See patch attached.

> I'd suggest you put my code back and roll the flawless version for
> 4.3-RELEASE, then hack it your way carefully again later.

I'd rather we try my patch, thanks.  No offense, but my meager Perl 
skills at least have a chance of understanding the code the way I 
wrote it.

Bruce.

? pkg_version.diff
Index: pkg_version.pl
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/version/pkg_version.pl,v
retrieving revision 1.17
diff -c -r1.17 pkg_version.pl
*** pkg_version.pl	2001/04/03 21:26:32	1.17
--- pkg_version.pl	2001/04/19 20:53:07
***************
*** 148,154 ****
  	    else {
  		$c1 =~ s/\d+//;
  		$c2 =~ s/\d+//;
! 		return &CompareNumbers($c1, $c2);
  	    }
  	}
      }
--- 148,165 ----
  	    else {
  		$c1 =~ s/\d+//;
  		$c2 =~ s/\d+//;
! 		if ($c1 eq $c2) {
! 		    return 0;
! 		}
! 		elsif ($c1 eq "") {
! 		    return -1;
! 		}
! 		elsif ($c2 eq "") {
! 		    return 1;
! 		}
! 		else {
! 		    return &CompareNumbers($c1, $c2);
! 		}
  	    }
  	}
      }
Index: test-pkg_version.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/version/test-pkg_version.sh,v
retrieving revision 1.1
diff -c -r1.1 test-pkg_version.sh
*** test-pkg_version.sh	2001/04/03 21:26:32	1.1
--- test-pkg_version.sh	2001/04/19 20:53:07
***************
*** 61,68 ****
  test-pv 2.3p10 ">" 2.3p9 number/letter
  test-pv 1.6.0 ">" 1.6.0.p3 number/letter
  test-pv 1.0.b ">" 1.0.a3 number/letter
! test-pv 1.0a "<" 1.0 number/letter
! test-pv 5.0a "<" 5.0.b number/letter
  
  test-pv 1.5_1 ">" 1.5 portrevision
  test-pv 1.5_2 ">" 1.5_1 portrevision
--- 61,69 ----
  test-pv 2.3p10 ">" 2.3p9 number/letter
  test-pv 1.6.0 ">" 1.6.0.p3 number/letter
  test-pv 1.0.b ">" 1.0.a3 number/letter
! test-pv 1.0a ">" 1.0 number/letter
! test-pv 1.0a "<" 1.0b number/letter
! test-pv 5.0a ">" 5.0.b number/letter
  
  test-pv 1.5_1 ">" 1.5 portrevision
  test-pv 1.5_2 ">" 1.5_1 portrevision




--==_Exmh_-120246284P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: Exmh version 2.2 06/23/2000

iD8DBQE631Ts2MoxcVugUsMRAhH0AKC2z2TofP30CvZJb51Uj696PhMytgCeL1gx
MLvgcHwIV8d/ByYhDDz5ZX0=
=Lain
-----END PGP SIGNATURE-----

--==_Exmh_-120246284P--

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




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