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 Apr 27 22:24:16 UTC 2022

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

Log Message:
lintpkgsrc: fix Perl warning when parsing variable expressions

When parse-guessing a package Makefile, lintpkgsrc tries to evaluate
variable expressions such as ${VAR:S,from,to,} by passing them through
Perl's eval function.

In a variable expression of the form ${VAR:S,@exec@,${exec},}, this
produced Perl warnings due to the unescaped '@':

        Possible unintended interpolation of @exec in string at
        (eval 63841) line 1.

As a quick fix, skip ':S' modifiers that contain the character '@' for
now.  A proper fix will follow.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

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.21 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.22
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.21 Sat Jan  1 13:27:37 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Wed Apr 27 22:24:16 2022
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.21 2022/01/01 13:27:37 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.22 2022/04/27 22:24:16 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -485,6 +485,7 @@ sub deweycmp($$$) {
         $cmp = deweycmp_extract( $match_nb, $val_nb );
     }
 
+    debug("eval deweycmp $cmp $test 0\n");
     eval "$cmp $test 0";
 }
 
@@ -1309,7 +1310,7 @@ sub parse_makefile_vars($$) {
                 foreach (@patterns) {
                     if (m#(U)(.*)#) {
                        $result ||= $2;
-                    } elsif (m#([CS])(.)([^/]+)\2([^/]*)\2([1g]*)#) {
+                    } elsif (m#([CS])(.)([^/@]+)\2([^/@]*)\2([1g]*)#) {
 
                         my ( $how, $from, $to, $global ) = ( $1, $3, $4, $5 );
 
@@ -1332,6 +1333,7 @@ sub parse_makefile_vars($$) {
                         debug(
                             "$file: substituteperl $subvar, $how, $from, $to\n"
                         );
+                        debug("eval substitute <$from> <$to> <$global>\n");
                         eval "\$result =~ s/$from/$to/$global";
                         if ( defined $notfirst ) {
                             $result .= " $notfirst";
@@ -1456,6 +1458,7 @@ sub parse_eval_make_false($$) {
     }
 
     if ( $test !~ /[^<>\d()\s&|.!]/ ) {
+       debug("eval test $test\n");
         $false = eval "($test)?0:1";
         if ( !defined $false ) {
             fail("Eval failed $line - $test");
@@ -1686,6 +1689,7 @@ sub load_pkgsrc_makefiles() {
     our ( $pkgcnt, $pkgnum, $subpkgcnt, $subpkgnum );
     $pkglist = new PkgList;
     while (<STORE>) {
+       debug("eval store $_");
         eval $_;
     }
     close(STORE);



Home | Main Index | Thread Index | Old Index