NetBSD Problem Report #55516

From dholland@netbsd.org  Sun Jul 26 05:14:11 2020
Return-Path: <dholland@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 502D31A9218
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 26 Jul 2020 05:14:11 +0000 (UTC)
Message-Id: <20200726051411.0D9F284CF7@mail.netbsd.org>
Date: Sun, 26 Jul 2020 05:14:11 +0000 (UTC)
From: dholland@NetBSD.org
Reply-To: dholland@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: pkgtools/pkglint objecting to comments
X-Send-Pr-Version: 3.95

>Number:         55516
>Category:       pkg
>Synopsis:       pkgtools/pkglint objecting to comments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rillig
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 26 05:15:00 +0000 2020
>Closed-Date:    Sun Aug 02 13:29:05 +0000 2020
>Last-Modified:  Sun Aug 02 13:30:04 +0000 2020
>Originator:     David A. Holland
>Release:        irrelevant, pkglint 20.1.19 from 20200622
>Organization:
>Environment:
System: irrelevant
Architecture: x86_64
Machine: amd64
>Description:

I have a patch with (among other things) this text:
    // Special case, for Linux: the resource files are not in the same place as
    // the executable, but are under the same prefix (/usr or /usr/local).
 +  // ...or /usr/pkg or /usr/contrib or /opt or...

which prompts pkglint to object with

ERROR: patches/patch-source_Files.cpp:41: Patches must not hard-code the pkgsrc PREFIX.

which is, ultimately, pretty silly.

Maybe pkglint can skip comments on patches based on the filename
suffix, since we now name patches after the file they patch?

Just doing the equivalent of

   case $PATCH in
      *.[ch]|*.[CH]|*.[ch]pp|*.[ch]xx) sed 's,//.*,,;s,/\*[^*]\*/,,'
      *.sh|*.mk) sed 's,#.*,,'
      *) cat
   esac

would cover a large fraction of the cases at little cost.

>How-To-Repeat:

as above.

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->rillig
Responsible-Changed-By: rillig@NetBSD.org
Responsible-Changed-When: Sun, 02 Aug 2020 12:55:49 +0000
Responsible-Changed-Why:
Over to maintainer


State-Changed-From-To: open->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Sun, 02 Aug 2020 13:29:05 +0000
State-Changed-Why:
I fixed this by ignoring absolute paths in C-style end-of-line comments
in the same way as C-style block comments were already ignored.  Shell
comments already had the same effect.

Thanks for the PR.


From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55516 CVS commit: pkgsrc/pkgtools/pkglint
Date: Sun, 2 Aug 2020 13:27:17 +0000

 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.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.