pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Wed Aug  3 20:50:43 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
        pkgsrc/pkgtools/lintpkgsrc/files/t: pkgversion.t

Log Message:
lintpkgsrc: fix off-by-9 bug in version comparison (since today)


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.49 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.50
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.49 Wed Aug  3 20:39:27 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Wed Aug  3 20:50:43 2022
@@ -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 @@ sub split_pkgversion($) {
        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 @@ sub split_pkgversion($) {
                        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);
                                }
                        }
                }

Index: pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.6 pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.7
--- pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.6 Wed Aug  3 20:39:27 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t     Wed Aug  3 20:50:43 2022
@@ -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.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