NetBSD Problem Report #55524

From triaxx@netbsd.org  Thu Jul 30 09:29:10 2020
Return-Path: <triaxx@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 52BE11A9213
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Jul 2020 09:29:10 +0000 (UTC)
Message-Id: <20200730092909.38E971A921A@mollari.NetBSD.org>
Date: Thu, 30 Jul 2020 09:29:09 +0000 (UTC)
From: triaxx@netbsd.org
Reply-To: triaxx@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: pkgtools/pkglint raises an error for paths containing /etc in patches
X-Send-Pr-Version: 3.95

>Number:         55524
>Category:       pkg
>Synopsis:       pkgtools/pkglint raises an error for paths containing /etc in patches
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rillig
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 30 09:30:00 +0000 2020
>Closed-Date:    Sun Aug 02 13:32:35 +0000 2020
>Last-Modified:  Sun Aug 02 13:35:01 +0000 2020
>Originator:     Frédéric Fauberteau
>Release:        pkgsrc-HEAD
>Organization:
>Environment:
System: FreeBSD cocoon.triaxx.org 12.1-RELEASE-p7 FreeBSD 12.1-RELEASE-p7 GENERIC  amd64
Architecture: x86_64
Machine: amd64
>Description:
The following errors are raised for patch given below:
ERROR: patches/patch-src_daemon.c:22: Patches must not hard-code the pkgsrc PKG_SYSCONFDIR.
ERROR: patches/patch-src_daemon.c:35: Patches must not hard-code the pkgsrc PKG_SYSCONFDIR.

  1 $NetBSD: patch-src_daemon.c,v 1.1 2018/06/11 23:55:50 youri Exp $
  2 
  3 Add NetBSD backend inspired from OpenBSD ports.
  4 
  5 --- src/daemon.c.orig 2015-02-25 13:51:44.000000000 +0000
  6 +++ src/daemon.c
  7 @@ -29,6 +29,7 @@
  8  #include <fcntl.h>
  9  #include <sys/wait.h>
 10  #include <pwd.h>
 11 +#include <grp.h>
 12  #include <unistd.h>
 13  #include <errno.h>
 14  #include <sys/types.h>
 15 @@ -46,9 +47,13 @@
 16  #include "util.h"
 17 
 18  #define PATH_PASSWD "/etc/passwd"
 19 +#if defined(HAVE_SHADOW_H)
 20  #define PATH_SHADOW "/etc/shadow"
 21 +#elif defined(__NetBSD__) || defined(__FreeBSD__)
 22 +#define PATH_SHADOW "/etc/master.passwd"
 23 +#endif
 24  #define PATH_GROUP "/etc/group"
 25 -#define PATH_GDM_CUSTOM "/etc/gdm/custom.conf"
 26 +#define PATH_GDM_CUSTOM "@PKG_SYSCONFDIR@/gdm/custom.conf"
 27 
 28  enum {
 29          PROP_0,
 30 @@ -1083,6 +1088,34 @@ daemon_delete_user_authorized_cb (Daemon
 31                  return;
 32          }
 33 
 34 +/*
 35 + * Under NetBSD there is no /etc/login.defs (for USERGROUPS_ENAB), so
 36 + * we need to explicitely remove the user's group if it contains no more
 37 + * members and matches the username.
 38 + */
>How-To-Repeat:
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->rillig
Responsible-Changed-By: triaxx@NetBSD.org
Responsible-Changed-When: Thu, 30 Jul 2020 09:41:41 +0000
Responsible-Changed-Why:
rillig@ is the maintainter of the package. He is one of the best people to identify a solution.


State-Changed-From-To: open->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Sun, 02 Aug 2020 13:32:35 +0000
State-Changed-Why:
I fixed this by explicitly allowing /etc/passwd, /etc/shadow and
/etc/hosts to be added in patches.  And by ignoring and thereby allowing
absolute pathnames in continued C-style block comments.

The fix is available since pkglint 20.2.6, which I just updated.

If you have any ideas how to reliably tell paths from the base system
and paths that belong to pkgsrc apart, please tell me. I'm open for
ideas.  Having a hard-coded list was just the simplest idea to solve
this immediate wrong error message.

Thanks for the PR.


From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55524 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.