Received: by mail.netbsd.org (Postfix, from userid 605) id 414D184E61; Tue, 9 Aug 2022 18:14:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 7B56A84D6C for ; Tue, 9 Aug 2022 18:14:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id pTElVDlyN0Jn for ; Tue, 9 Aug 2022 18:14:22 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id A612684D41 for ; Tue, 9 Aug 2022 18:14:22 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 9F616FB1A; Tue, 9 Aug 2022 18:14:22 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_166006886288310" MIME-Version: 1.0 Date: Tue, 9 Aug 2022 18:14:22 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/lintpkgsrc To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20220809181422.9F616FB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_166006886288310 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Tue Aug 9 18:14:22 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc: Makefile pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl pkgsrc/pkgtools/lintpkgsrc/files/t: glob.t Log Message: lintpkgsrc: fix conversion of glob pattern to regular expression It is used for evaluating expression modifiers of the form ':S,from,to,'. Bump version. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 pkgsrc/pkgtools/lintpkgsrc/Makefile cvs rdiff -u -r1.56 -r1.57 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl cvs rdiff -u -r1.4 -r1.5 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_166006886288310 Content-Disposition: inline Content-Length: 4019 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/lintpkgsrc/Makefile diff -u pkgsrc/pkgtools/lintpkgsrc/Makefile:1.46 pkgsrc/pkgtools/lintpkgsrc/Makefile:1.47 --- pkgsrc/pkgtools/lintpkgsrc/Makefile:1.46 Thu Aug 4 21:55:57 2022 +++ pkgsrc/pkgtools/lintpkgsrc/Makefile Tue Aug 9 18:14:22 2022 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.46 2022/08/04 21:55:57 rillig Exp $ +# $NetBSD: Makefile,v 1.47 2022/08/09 18:14:22 rillig Exp $ -PKGNAME= lintpkgsrc-4.99 +PKGNAME= lintpkgsrc-2022.08.09 CATEGORIES= pkgtools MAINTAINER= pkgsrc-users@NetBSD.org @@ -10,7 +10,6 @@ COMMENT= Sanity checks on the complete p DEPENDS+= digest>=20010101:../../pkgtools/digest TEST_DEPENDS+= p5-File-Slurp>=0:../../devel/p5-File-Slurp TEST_DEPENDS+= p5-IO-Null>=0:../../devel/p5-IO-Null -CONFLICTS+= pkglint<4.82 USE_TOOLS+= perl:run Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.56 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.57 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.56 Thu Aug 4 21:55:58 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Tue Aug 9 18:14:22 2022 @@ -1,6 +1,6 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.56 2022/08/04 21:55:58 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.57 2022/08/09 18:14:22 rillig Exp $ # Written by David Brownlee . # @@ -874,6 +874,9 @@ sub list_pkgsrc_pkgdirs($$) { @pkgdirs; } +# Convert the glob pattern to a regular expression. +# Return '' if the regular expression equals the glob expression. +# Return undef on error. sub glob2regex($) { my ($glob) = @_; my (@chars, $in_alt); @@ -886,8 +889,8 @@ sub glob2regex($) { } elsif ($_ eq '?') { $regex .= '.'; } elsif ($_ eq '+') { - $regex .= '.'; - } elsif ($_ eq '\\+') { + $regex .= '\\+'; + } elsif ($_ eq '\\') { $regex .= $_ . shift @chars; } elsif ($_ eq '.' || $_ eq '|') { $regex .= quotemeta; Index: pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.4 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.5 --- pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.4 Tue Aug 9 17:53:47 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t Tue Aug 9 18:14:22 2022 @@ -1,4 +1,4 @@ -# $NetBSD: glob.t,v 1.4 2022/08/09 17:53:47 rillig Exp $ +# $NetBSD: glob.t,v 1.5 2022/08/09 18:14:22 rillig Exp $ use strict; use warnings; @@ -14,24 +14,19 @@ sub test_glob2regex() { ok(glob2regex('?'), '^.$'); - # The '' means that the regular expression equals the glob. ok(glob2regex('[a-z]'), ''); - # The '' means that the regular expression equals the glob. ok(glob2regex('[a-z0-9]'), ''); - # The '' means that the regular expression equals the glob. ok(glob2regex('[a-z0-9_]'), ''); # Outside of braces, the ',' is a regular character. - # The '' means that the regular expression equals the glob. ok(glob2regex('a,b'), ''); # FIXME: Inside brackets, the '*' is a literal '*'. ok(glob2regex('[*]'), '^[.*]$'); - # FIXME: After a backslash, the '*' must be preserved. - ok(glob2regex('\*'), '^\.*$'); + ok(glob2regex('\*'), ''); ok(glob2regex('*.[ch]'), '^.*\.[ch]$'); @@ -42,21 +37,20 @@ sub test_glob2regex() { # There is an unbalanced '}' at the very end. ok(glob2regex('{{thi,fou}r,fif}teen}'), undef); - # XXX: Why is '+' turned into '.'? - ok(glob2regex('a+b|c'), '^a.b\|c$'); + ok(glob2regex('a+b|c'), '^a\+b\|c$'); - # XXX: Typo in the code, the case '\\+' is unreachable. - # Escaping the backslash works nevertheless. ok(glob2regex('a\[b*'), '^a\[b.*$'); - ok(glob2regex('a\+b'), '^a\.b$'); + ok(glob2regex('a\+b'), ''); - # FIXME: Must be '^a\?b$' instead. - ok(glob2regex('a\?b'), '^a\.b$'); + ok(glob2regex('a\?b'), ''); # XXX: Depending on the exact implementation, the '\n' may be # interpreted as a newline, a literal 'n' or a literal '\' 'n'. ok(glob2regex('a\n*'), '^a\n.*$'); + + # https://gnats.netbsd.org/12996 + ok(glob2regex('libsigc++'), '^libsigc\+\+$'); } test_glob2regex(); --_----------=_166006886288310--