diff options
author | rillig <rillig@pkgsrc.org> | 2022-04-27 22:24:16 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2022-04-27 22:24:16 +0000 |
commit | acf01d360addf739fd954d035177fe9683003cc9 (patch) | |
tree | fbfcfad202d0b07eb9e1c1c8552dcb4b23151814 /pkgtools | |
parent | 699495a19553facf480ecdac1025e14c99d56d27 (diff) | |
download | pkgsrc-acf01d360addf739fd954d035177fe9683003cc9.tar.gz |
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.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/lintpkgsrc/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/pkgtools/lintpkgsrc/Makefile b/pkgtools/lintpkgsrc/Makefile index 5a32a00c4d9..fe5cdb4fab2 100644 --- a/pkgtools/lintpkgsrc/Makefile +++ b/pkgtools/lintpkgsrc/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.37 2022/01/01 13:27:37 rillig Exp $ +# $NetBSD: Makefile,v 1.38 2022/04/27 22:25:22 rillig Exp $ -PKGNAME= lintpkgsrc-4.97 +PKGNAME= lintpkgsrc-4.98 CATEGORIES= pkgtools MAINTAINER= pkgsrc-users@NetBSD.org diff --git a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl index f8beeaac632..4c506d4b034 100755 --- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl +++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl @@ -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>. # @@ -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); |