Received: by mail.netbsd.org (Postfix, from userid 605) id 4451D84ECC; Fri, 12 Aug 2022 22:45:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 7E9D884E60 for ; Fri, 12 Aug 2022 22:45:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 9-3GqxohaSkm for ; Fri, 12 Aug 2022 22:45:15 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id E868084DA5 for ; Fri, 12 Aug 2022 22:45:14 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id E1A19FB1A; Fri, 12 Aug 2022 22:45:14 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1660344314181780" MIME-Version: 1.0 Date: Fri, 12 Aug 2022 22:45:14 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/lintpkgsrc/files To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20220812224514.E1A19FB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1660344314181780 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Fri Aug 12 22:45:14 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl pkgsrc/pkgtools/lintpkgsrc/files/t: parse_makefile.t Log Message: lintpkgsrc: fix parsing of modifiers in makefiles To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1660344314181780 Content-Disposition: inline Content-Length: 2173 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.80 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.81 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.80 Fri Aug 12 22:40:40 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Fri Aug 12 22:45:14 2022 @@ -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 . # @@ -445,10 +445,9 @@ sub expand_modifiers($file, $varname, $l 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); Index: pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.9 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.10 --- pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.9 Fri Aug 12 22:40:40 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:45:14 2022 @@ -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}, ''); + # 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}, ''); expand_modifiers('file.mk', 'VAR', '<', 'REF', 'S,VAL,H,', '>', $vars); --_----------=_1660344314181780--