pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: fix off-by-9 bug...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e85df8350bfa
branches: trunk
changeset: 382725:e85df8350bfa
user: rillig <rillig%pkgsrc.org@localhost>
date: Wed Aug 03 20:50:43 2022 +0000
description:
lintpkgsrc: fix off-by-9 bug in version comparison (since today)
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 6 +++---
pkgtools/lintpkgsrc/files/t/pkgversion.t | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r 93f322556705 -r e85df8350bfa pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 03 20:39:27 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 03 20:50:43 2022 +0000
@@ -1,6 +1,6 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.49 2022/08/03 20:39:27 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.50 2022/08/03 20:50:43 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -305,7 +305,7 @@
my $nb = ($pkgversion =~ s/^(.*)nb(\d+)$/$1/) ? +$2 : 0;
foreach my $elem (split(/(\D+)/, lc($pkgversion))) {
if ($elem =~ /\d/) {
- push(@temp, $elem);
+ push(@temp, +$elem);
} elsif ($elem eq "pl" || $elem eq "." || $elem eq "_") {
push(@temp, 0);
} elsif ($elem eq "pre" || $elem eq "rc") {
@@ -318,7 +318,7 @@
foreach my $ch (split(//, $elem)) {
if ('a' le $ch && $ch le 'z') {
push(@temp, 0);
- push(@temp, ord($ch) - ord('a') + 10);
+ push(@temp, ord($ch) - ord('a') + 1);
}
}
}
diff -r 93f322556705 -r e85df8350bfa pkgtools/lintpkgsrc/files/t/pkgversion.t
--- a/pkgtools/lintpkgsrc/files/t/pkgversion.t Wed Aug 03 20:39:27 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/pkgversion.t Wed Aug 03 20:50:43 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: pkgversion.t,v 1.6 2022/08/03 20:39:27 rillig Exp $
+# $NetBSD: pkgversion.t,v 1.7 2022/08/03 20:50:43 rillig Exp $
use strict;
use warnings;
@@ -15,3 +15,5 @@
ok(pkgversioncmp('3.4nb13', '<', '3.4'), '');
ok(pkgversioncmp('3.4nb13', '>', '3.4nb5'), 1);
ok(pkgversioncmp('1.1ab', '>', '1.1aa'), 1);
+ok(pkgversioncmp('1.1ab', '<=', '1.1.1.2'), 1);
+ok(pkgversioncmp('1.1ab', '>=', '1.1.1.2'), 1);
Home |
Main Index |
Thread Index |
Old Index