diff options
author | rillig <rillig@pkgsrc.org> | 2022-08-12 22:45:14 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2022-08-12 22:45:14 +0000 |
commit | f400b4b670fc50aea78eb03739e20a0454534302 (patch) | |
tree | 0f1ca8528ff3f4f66b6ce07ec30dafa7e359a618 /pkgtools | |
parent | 477cc382ad1da14f5ec3ce4f6549c23e9422dd1d (diff) | |
download | pkgsrc-f400b4b670fc50aea78eb03739e20a0454534302.tar.gz |
lintpkgsrc: fix parsing of modifiers in makefiles
Diffstat (limited to 'pkgtools')
-rwxr-xr-x | pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 7 | ||||
-rw-r--r-- | pkgtools/lintpkgsrc/files/t/parse_makefile.t | 9 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl index 0550314b300..8cd41eb6aa8 100755 --- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl +++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl @@ -1,6 +1,6 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.80 2022/08/12 22:40:40 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.81 2022/08/12 22:45:14 rillig Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -445,10 +445,9 @@ sub expand_modifiers($file, $varname, $left, $subvar, $mods, $right, $vars) { debug("$file: substitutelist $varname ($result) $subvar (@mods)\n"); foreach (@mods) { - # FIXME: Add '^' anchor. - if (m# (U) (.*) #x) { + if (m#^ (U) (.*) #x) { $result ||= "fallback:$2"; - } elsif (m# ([CS]) (.) ([^/\@]+) \2 ([^/\@]*) \2 ([1g]*) #x) { + } elsif (m#^ ([CS]) (.) ([^/\@]+) \2 ([^/\@]*) \2 ([1g]*) #x) { # TODO: Use non-greedy repetitions above. # TODO: Properly handle separators other than '/' and '@'. my ($how, $from, $to, $global) = ($1, $3, $4, $5); diff --git a/pkgtools/lintpkgsrc/files/t/parse_makefile.t b/pkgtools/lintpkgsrc/files/t/parse_makefile.t index 5931122d7c4..7f194bd3038 100644 --- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t +++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t @@ -1,4 +1,4 @@ -# $NetBSD: parse_makefile.t,v 1.9 2022/08/12 22:40:40 rillig Exp $ +# $NetBSD: parse_makefile.t,v 1.10 2022/08/12 22:45:14 rillig Exp $ use strict; use warnings; @@ -101,9 +101,10 @@ sub test_expand_modifiers() { expand_modifiers('file.mk', 'VAR', '<', 'REF', 'S,U,X,', '>', $vars); - # FIXME: Should be 'VALXE', but the 'U' is wrongly interpreted as a - # ':U' modifier. - ok($vars->{VAR}, '<VALUE>'); + # Ensure that the 'U' in the modifier 'S,U,X,' is not interpreted as + # the modifier ':U'. Before lintpkgsrc.pl 1.81 from 2022-08-13, + # lintpkgsrc did exactly that. + ok($vars->{VAR}, '<VALXE>'); expand_modifiers('file.mk', 'VAR', '<', 'REF', 'S,VAL,H,', '>', $vars); |