summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/version
diff options
context:
space:
mode:
authorbmah <bmah@FreeBSD.org>2001-04-19 22:17:07 +0000
committerbmah <bmah@FreeBSD.org>2001-04-19 22:17:07 +0000
commitd3d65388a66be6e09c5547a04dd61efc963bbe9f (patch)
tree4f80974c79b40fa51043bd5ae3327044c2ed27a1 /usr.sbin/pkg_install/version
parentaeb55b5464620d5c6f8fb5fcae87f8d5bb90764a (diff)
downloadFreeBSD-src-d3d65388a66be6e09c5547a04dd61efc963bbe9f.zip
FreeBSD-src-d3d65388a66be6e09c5547a04dd61efc963bbe9f.tar.gz
Fix a problem with tests of the form "1.0" vs. "1.0a".
MFC candidate. Pointed out by: knu
Diffstat (limited to 'usr.sbin/pkg_install/version')
-rwxr-xr-xusr.sbin/pkg_install/version/pkg_version.pl13
-rwxr-xr-xusr.sbin/pkg_install/version/test-pkg_version.sh5
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/version/pkg_version.pl b/usr.sbin/pkg_install/version/pkg_version.pl
index 8b48090..7118fab 100755
--- a/usr.sbin/pkg_install/version/pkg_version.pl
+++ b/usr.sbin/pkg_install/version/pkg_version.pl
@@ -148,7 +148,18 @@ sub CompareNumbers {
else {
$c1 =~ s/\d+//;
$c2 =~ s/\d+//;
- return &CompareNumbers($c1, $c2);
+ if ($c1 eq $c2) {
+ return 0;
+ }
+ elsif ($c1 eq "") {
+ return -1;
+ }
+ elsif ($c2 eq "") {
+ return 1;
+ }
+ else {
+ return &CompareNumbers($c1, $c2);
+ }
}
}
}
diff --git a/usr.sbin/pkg_install/version/test-pkg_version.sh b/usr.sbin/pkg_install/version/test-pkg_version.sh
index 6c14c71..3cfaea1 100755
--- a/usr.sbin/pkg_install/version/test-pkg_version.sh
+++ b/usr.sbin/pkg_install/version/test-pkg_version.sh
@@ -61,8 +61,9 @@ test-pv 0.9 "<" 0.10 inequality
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.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
OpenPOWER on IntegriCloud