NetBSD Problem Report #58961

From www@netbsd.org  Sun Jan  5 07:10:08 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2331C1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  5 Jan 2025 07:10:08 +0000 (UTC)
Message-Id: <20250105071006.568D91A923B@mollari.NetBSD.org>
Date: Sun,  5 Jan 2025 07:10:06 +0000 (UTC)
From: iris000@duck.com
Reply-To: iris000@duck.com
To: gnats-bugs@NetBSD.org
Subject: 'make print-PLIST' emits 'No such file or directory' when directories contain spaces
X-Send-Pr-Version: www-1.0

>Number:         58961
>Category:       pkg
>Synopsis:       'make print-PLIST' emits 'No such file or directory' when directories contain spaces
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 05 07:15:00 +0000 2025
>Last-Modified:  Tue Jan 07 08:25:01 +0000 2025
>Originator:     Iris
>Release:        pkgsrc-2024Q4
>Organization:
>Environment:
NetBSD localhost 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Linux localhost.localdomain 6.12.7 #1 SMP PREEMPT_DYNAMIC Fri Dec 27 19:45:31 UTC 2024 x86_64 GNU/Linux

>Description:
'make print-PLIST' will emit 'No such file or directory' when
encountering directories that have spaces (e.g. biology/fastqc,
net/wireshark).

Filenames with spaces don't exhibit this behavior (e.g. ham/osmo-sdr,
fonts/awesome-otf).

Judging from 'mk/plist/print-plist.mk', and from what I can tell from
adding entries to INSTALLATION_DIRS, 'make print-PLIST' does end up
missing @pkgdir entries when encountering empty directories with
spaces.  (I'm not sure if there are packages that are actually doing
this.)  Other than that, I *think* PLISTs are otherwise being generated
correctly.

> # pwd
> /usr/pkgsrc/net/wireshark

> # make print-PLIST | tee ./new
> @comment $NetBSD$
> [...]
> ls: /usr/work/net/wireshark/work/.destdir/usr/pkg/share/wireshark/profiles/No: No such file or directory
> ls: /usr/work/net/wireshark/work/.destdir/usr/pkg/Reassembly: No such file or directory

> # grep Reassembly ./PLIST ./new
> ./PLIST:share/wireshark/profiles/No Reassembly/preferences
> ./new:share/wireshark/profiles/No Reassembly/preferences
>How-To-Repeat:
In any package that installs files into directories that contain spaces
(e.g. biology/fastqc, net/wireshark):

1. 'make install' or 'make package'
2. 'make print-PLIST'

Add additional directories with or without spaces to INSTALLATION_DIRS,
and repeat 'install' and 'print-PLIST' steps
>Fix:

>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: iris000@duck.com
Cc: gnats-bugs@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/58961: 'make print-PLIST' emits 'No such file or directory' when directories contain spaces
Date: Sun, 5 Jan 2025 07:24:42 +0000

 This is a multi-part message in MIME format.
 --=_zuuYtksK0C8RJaF9J8AwVVP/KZSlw/L+

 Can you please try the attached patch and see if it helps?

 --=_zuuYtksK0C8RJaF9J8AwVVP/KZSlw/L+
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr58961-printplistifs"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr58961-printplistifs.patch"

 diff --git a/mk/plist/print-plist.mk b/mk/plist/print-plist.mk
 index a41caa2ededa..1ff5af440f4b 100644
 --- a/mk/plist/print-plist.mk
 +++ b/mk/plist/print-plist.mk
 @@ -138,6 +138,7 @@ print-PLIST:
  		/^man\// { sub("\\.gz$$", ""); }			\
  		{ print $$0; }'
  	${RUN}\
 +	saveIFS=3D$$IFS; IFS=3D$$(printf '\n');				\
  	for i in `${_PRINT_PLIST_DIRS_CMD}				\
  			| ${AWK} '					\
  				${EARLY_PRINT_PLIST_AWK}		\
 @@ -154,8 +155,9 @@ print-PLIST:
  				/^${PKGINFODIR:S|/|\\/|g}$$/ { next; }	\
  				{ print $$0; }'` ;			\
  	do								\
 -		if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` =3D 3 ]; then	\
 -			${ECHO} @pkgdir $$i | ${AWK} '			\
 +		IFS=3D$$saveIFS;						\
 +		if [ `${LS} -la ${DESTDIR}${PREFIX}/"$$i" | ${WC} -l` =3D 3 ]; then	\
 +			${ECHO} @pkgdir "$$i" | ${AWK} '		\
  			${PRINT_PLIST_AWK}				\
  			{ print $$0; }' ;				\
  		fi ;							\

 --=_zuuYtksK0C8RJaF9J8AwVVP/KZSlw/L+--

From: Taylor R Campbell <riastradh@NetBSD.org>
To: iris000@duck.com
Cc: gnats-bugs@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/58961: 'make print-PLIST' emits 'No such file or directory' when directories contain spaces
Date: Sun, 5 Jan 2025 13:17:50 +0000

 This is a multi-part message in MIME format.
 --=_kfI//mdIC0kx2NGNjppVUyLgYbxCgVBW

 Correction -- updated patch attached, to work around the quirk of
 shells where x=$(...) strips the trailing newlines of the command
 output.

 --=_kfI//mdIC0kx2NGNjppVUyLgYbxCgVBW
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr58961-printplistifs-v2"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr58961-printplistifs-v2.patch"

 diff --git a/mk/plist/print-plist.mk b/mk/plist/print-plist.mk
 index a41caa2ededa..b758d7cfe11b 100644
 --- a/mk/plist/print-plist.mk
 +++ b/mk/plist/print-plist.mk
 @@ -138,6 +138,7 @@ print-PLIST:
  		/^man\// { sub("\\.gz$$", ""); }			\
  		{ print $$0; }'
  	${RUN}\
 +	saveIFS=3D$$IFS; IFS=3D$$(printf '\n.'); IFS=3D$${IFS%.};		\
  	for i in `${_PRINT_PLIST_DIRS_CMD}				\
  			| ${AWK} '					\
  				${EARLY_PRINT_PLIST_AWK}		\
 @@ -154,8 +155,9 @@ print-PLIST:
  				/^${PKGINFODIR:S|/|\\/|g}$$/ { next; }	\
  				{ print $$0; }'` ;			\
  	do								\
 -		if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` =3D 3 ]; then	\
 -			${ECHO} @pkgdir $$i | ${AWK} '			\
 +		IFS=3D$$saveIFS;						\
 +		if [ `${LS} -la ${DESTDIR}${PREFIX}/"$$i" | ${WC} -l` =3D 3 ]; then	\
 +			${ECHO} @pkgdir "$$i" | ${AWK} '		\
  			${PRINT_PLIST_AWK}				\
  			{ print $$0; }' ;				\
  		fi ;							\

 --=_kfI//mdIC0kx2NGNjppVUyLgYbxCgVBW--

From: iris000@duck.com
To: Taylor R Campbell <riastradh@NetBSD.org>
Cc: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>,
 "pkgsrc-bugs@NetBSD.org" <pkgsrc-bugs@NetBSD.org>
Subject: Re: pkg/58961: 'make print-PLIST' emits 'No such file or directory' when
 directories contain spaces
Date: Tue, 07 Jan 2025 00:01:12 -0500

 Taylor R Campbell wrote:
 > Can you please try the attached patch and see if it helps?

 > Correction -- updated patch attached, to work around the quirk of
 > shells where x=$(...) strips the trailing newlines of the command
 > output.

 I can confirm with 'pr58961-printplistifs-v2.patch' that 'make
 print-PLIST' no longer shows 'No such file or directory' when
 encountering directory names with spaces, and that @pkgdir entries are
 now being generated for empty directories when their paths contain a
 space (and @pkgdir entries without spaces are hopefully unchanged).

 (It seems biology/fastqc upstream has shipped with these empty
 directories since v0.11.6, just that @pkgdir entries could not be
 generated for them until now.)

 > --- PLIST
 > +++ PLIST.new
 > @@ -1,4 +1,4 @@
 > -@comment $NetBSD: PLIST,v 1.1 2021/01/20 15:57:17 bacon Exp $
 > +@comment $NetBSD$
 >  bin/fastqc
 >  share/doc/fastqc/Help/1 Introduction/.svn/entries
 >  share/doc/fastqc/Help/1 Introduction/.svn/text-base/1.1 What is FastQC.html.svn-base
 > @@ -244,3 +244,9 @@
 >  share/java/classes/fastqc/uk/ac/babraham/FastQC/Utilities/NanoporeBasename.class
 >  share/java/classes/fastqc/uk/ac/babraham/FastQC/Utilities/QualityCount.class
 >  share/java/classes/fastqc/uk/ac/babraham/FastQC/Utilities/RGB.class
 > +@pkgdir share/doc/fastqc/Help/3 Analysis Modules/.svn/tmp/props
 > +@pkgdir share/doc/fastqc/Help/3 Analysis Modules/.svn/props
 > +@pkgdir share/doc/fastqc/Help/2 Basic Operations/.svn/tmp/props
 > +@pkgdir share/doc/fastqc/Help/2 Basic Operations/.svn/props
 > +@pkgdir share/doc/fastqc/Help/1 Introduction/.svn/tmp/props
 > +@pkgdir share/doc/fastqc/Help/1 Introduction/.svn/props

From: Taylor R Campbell <campbell@mumble.net>
To: iris000@duck.com
Cc: gnats-bugs@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/58961: 'make print-PLIST' emits 'No such file or directory' when
	directories contain spaces
Date: Tue, 7 Jan 2025 08:16:36 +0000

 > Date: Tue, 07 Jan 2025 03:11:13 -0500
 > From: iris000@duck.com
 >=20
 > Taylor R Campbell wrote:
 > > Can you please try the attached patch and see if it helps?
 >=20
 > > Correction -- updated patch attached, to work around the quirk of
 > > shells where x=3D$(...) strips the trailing newlines of the command
 > > output.
 >=20
 > I can confirm with 'pr58961-printplistifs-v2.patch' that 'make
 > print-PLIST' no longer shows 'No such file or directory' when
 > encountering directory names with spaces, and that @pkgdir entries are
 > now being generated for empty directories when their paths contain a
 > space (and @pkgdir entries without spaces are hopefully unchanged).

 Great, thanks!

 > (It seems biology/fastqc upstream has shipped with these empty
 > directories since v0.11.6, just that @pkgdir entries could not be
 > generated for them until now.)
 > [...]
 > >  share/doc/fastqc/Help/1 Introduction/.svn/entries
 > >  share/doc/fastqc/Help/1 Introduction/.svn/text-base/1.1 What is FastQC=
 .html.svn-base
 > [...]
 > > +@pkgdir share/doc/fastqc/Help/3 Analysis Modules/.svn/tmp/props
 > > +@pkgdir share/doc/fastqc/Help/3 Analysis Modules/.svn/props
 > > +@pkgdir share/doc/fastqc/Help/2 Basic Operations/.svn/tmp/props
 > > +@pkgdir share/doc/fastqc/Help/2 Basic Operations/.svn/props
 > > +@pkgdir share/doc/fastqc/Help/1 Introduction/.svn/tmp/props
 > > +@pkgdir share/doc/fastqc/Help/1 Introduction/.svn/props

 Grody!  I don't think any of these .svn directories should be there.
 Maybe we should have a check for directories named .svn, .git, .hg,
 _darcs, &c., in the destdir.  This package should maybe delete them in
 the do-install target before copying stuff to the destdir.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58961 CVS commit: pkgsrc/mk/plist
Date: Tue, 7 Jan 2025 08:23:23 +0000

 Module Name:	pkgsrc
 Committed By:	riastradh
 Date:		Tue Jan  7 08:23:23 UTC 2025

 Modified Files:
 	pkgsrc/mk/plist: print-plist.mk

 Log Message:
 print-PLIST: Handle spaces in pathnames.

 And, for that matter, anything except newlines (U+000a, LINE FEED).

 PR pkg/58961: 'make print-PLIST' emits 'No such file or directory'
 when directories contain spaces


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 pkgsrc/mk/plist/print-plist.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.