Received: by mail.netbsd.org (Postfix, from userid 605) id 1BF0484D24; Sun, 2 Aug 2020 13:27:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 94EBF84CE1 for ; Sun, 2 Aug 2020 13:27:18 +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 wGLrPELFNvKB for ; Sun, 2 Aug 2020 13:27:17 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id D0C3A84CDC for ; Sun, 2 Aug 2020 13:27:17 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id CA43CFB28; Sun, 2 Aug 2020 13:27:17 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1596374837260170" MIME-Version: 1.0 Date: Sun, 2 Aug 2020 13:27:17 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/pkglint To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20200802132717.CA43CFB28@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1596374837260170 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Sun Aug 2 13:27:17 UTC 2020 Modified Files: pkgsrc/pkgtools/pkglint: Makefile pkgsrc/pkgtools/pkglint/files: mklexer.go mklexer_test.go patches.go patches_test.go Log Message: pkgtools/pkglint: update to 20.2.6 Changes since 20.2.5: Some selected absolute paths, such as /etc/passwd, /etc/shadow and /etc/hosts are allowed in patch files. Other files in /etc should still use PKG_SYSCONFDIR, to keep the package portable between platforms and also in unprivileged mode. (Fixes PR pkg/55524.) Absolute pathnames are also allowed in C-style end-of-line comments (fixes PR pkg/55516) and in continuations of C-style block comments (fixes PR pkg/55524). The explanation for make's :ts modifier has been adjusted to the 2020 bmake update. The modifier :ts\040 is now interpreted as octal, as opposed to decimal. To generate a diff of this commit: cvs rdiff -u -r1.666 -r1.667 pkgsrc/pkgtools/pkglint/Makefile cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/pkglint/files/mklexer.go cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/pkglint/files/mklexer_test.go cvs rdiff -u -r1.44 -r1.45 pkgsrc/pkgtools/pkglint/files/patches.go cvs rdiff -u -r1.42 -r1.43 pkgsrc/pkgtools/pkglint/files/patches_test.go Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1596374837260170 Content-Disposition: inline Content-Length: 5436 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/pkglint/Makefile diff -u pkgsrc/pkgtools/pkglint/Makefile:1.666 pkgsrc/pkgtools/pkglint/Makefile:1.667 --- pkgsrc/pkgtools/pkglint/Makefile:1.666 Fri Jul 31 22:39:36 2020 +++ pkgsrc/pkgtools/pkglint/Makefile Sun Aug 2 13:27:17 2020 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.666 2020/07/31 22:39:36 rillig Exp $ +# $NetBSD: Makefile,v 1.667 2020/08/02 13:27:17 rillig Exp $ -PKGNAME= pkglint-20.2.5 +PKGNAME= pkglint-20.2.6 CATEGORIES= pkgtools DISTNAME= tools MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/} Index: pkgsrc/pkgtools/pkglint/files/mklexer.go diff -u pkgsrc/pkgtools/pkglint/files/mklexer.go:1.9 pkgsrc/pkgtools/pkglint/files/mklexer.go:1.10 --- pkgsrc/pkgtools/pkglint/files/mklexer.go:1.9 Wed Jul 1 13:17:41 2020 +++ pkgsrc/pkgtools/pkglint/files/mklexer.go Sun Aug 2 13:27:17 2020 @@ -367,7 +367,7 @@ func (p *MkLexer) varUseModifierTs( mod string, closing byte, lexer *textproc.Lexer, varname string, mark textproc.LexerMark) MkVarUseModifier { - // See devel/bmake/files/var.c:/case 't' + // See devel/bmake/files/var.c:/^ApplyModifier_ToSep/ sep := mod[2:] + p.varUseText(closing) switch { case sep == "": @@ -380,7 +380,7 @@ func (p *MkLexer) varUseModifierTs( p.Warnf("Invalid separator %q for :ts modifier of %q.", sep, varname) p.Explain( "The separator for the :ts modifier must be either a single character", - "or an escape sequence like \\t or \\n or an octal or decimal escape", + "or an escape sequence like \\t or \\n or an octal or hexadecimal escape", "sequence; see the bmake man page for further details.") } return MkVarUseModifier(lexer.Since(mark)) Index: pkgsrc/pkgtools/pkglint/files/mklexer_test.go diff -u pkgsrc/pkgtools/pkglint/files/mklexer_test.go:1.6 pkgsrc/pkgtools/pkglint/files/mklexer_test.go:1.7 --- pkgsrc/pkgtools/pkglint/files/mklexer_test.go:1.6 Wed Jul 1 13:17:41 2020 +++ pkgsrc/pkgtools/pkglint/files/mklexer_test.go Sun Aug 2 13:27:17 2020 @@ -641,8 +641,8 @@ func (s *Suite) Test_MkLexer_varUseModif "WARN: filename.mk:123: Invalid separator \"abc\" for :ts modifier of \"VAR\".", "", "\tThe separator for the :ts modifier must be either a single character", - "\tor an escape sequence like \\t or \\n or an octal or decimal escape", - "\tsequence; see the bmake man page for further details.", + "\tor an escape sequence like \\t or \\n or an octal or hexadecimal", + "\tescape sequence; see the bmake man page for further details.", "") } Index: pkgsrc/pkgtools/pkglint/files/patches.go diff -u pkgsrc/pkgtools/pkglint/files/patches.go:1.44 pkgsrc/pkgtools/pkglint/files/patches.go:1.45 --- pkgsrc/pkgtools/pkglint/files/patches.go:1.44 Thu Jul 23 18:40:41 2020 +++ pkgsrc/pkgtools/pkglint/files/patches.go Sun Aug 2 13:27:17 2020 @@ -296,11 +296,21 @@ func (ck *PatchChecker) checkAddedAbsPat return } - // Ignore paths inside C-style comments. + // Ignore paths inside C-style block comments. if contains(before, "/*") && contains(after, "*/") { return } + // Ignore paths inside multiline C-style block comments. + if hasPrefix(trimHspace(before), "*") { + return + } + + // Ignore paths inside C-style end-of-line comments. + if contains(before, "//") { + return + } + // Ignore composed C string literals such as PREFIX "/etc". if matches(before, `\w+[ \t]*"$`) { return @@ -313,6 +323,11 @@ func (ck *PatchChecker) checkAddedAbsPat return } + // Allow well-known pathnames that belong to the base system. + if matches(after, `hosts|passwd|shadow`) { + return + } + switch dir { case "/usr/pkg": Index: pkgsrc/pkgtools/pkglint/files/patches_test.go diff -u pkgsrc/pkgtools/pkglint/files/patches_test.go:1.42 pkgsrc/pkgtools/pkglint/files/patches_test.go:1.43 --- pkgsrc/pkgtools/pkglint/files/patches_test.go:1.42 Thu Jul 23 18:40:41 2020 +++ pkgsrc/pkgtools/pkglint/files/patches_test.go Sun Aug 2 13:27:17 2020 @@ -975,13 +975,15 @@ func (s *Suite) Test_PatchChecker_checkA // The dot before the "/etc" makes it a relative pathname. test( - "cp ./etc/hostname /tmp") + "cp ./etc/hostname /tmp", + nil...) // +> +# from /etc/inittab (SYSV systems) // +ERROR: devel/tet3/patches/patch-ac:51: Patches must not hard-code the pkgsrc PKG_SYSCONFDIR. test( - "# SysV /etc/install, /usr/sbin/install") + "# SysV /etc/install, /usr/sbin/install", + nil...) // C or C++ program, macro definition. // This is an absolute path since the PID_FILE is the macro name, @@ -995,8 +997,28 @@ func (s *Suite) Test_PatchChecker_checkA "#define PID_FILE PREFIX \"/etc/conf\"", nil...) + // In C-style block comments, absolute pathnames are ok, + // even though they could still be confusing. + test( + "#define L 150 /* Length of a line in /etc/some/file */", + nil...) + + // In multiline C-style block comment, absolute pathnames are ok, + // even though they could still be confusing. + test( + " * Length of a line in /etc/some/file", + nil...) + + // In C-style end-of-line comments, absolute pathnames are ok, + // // even though they could still be confusing. + test( + "#define L 150 // Length of a line in /etc/some/file", + nil...) + + // Allow /etc/passwd, /etc/shadow, /etc/hosts and their variants. + // These belong to the base system, not to pkgsrc. test( - "#define L 150 /* Length of a line in /etc/passwd */", + "#define PATH_SHADOW \"/etc/master.passwd\"", nil...) test( --_----------=_1596374837260170--