Subject: pkgsrc coding style (was: Weird problem if no PLIST?)
To: None <tech-pkg@netbsd.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 07/14/2005 08:23:19
Richard Rauch wrote:
> I was making a local package and because I wasn't sure which files
> might have been added, I removed the PLIST (planning to do make
> print-PLIST when done). Without any PLIST file in the package
> directory, the package (a library) froze up around here:
>
> Looking at top, I noticed that root had an awk process started.
> But the CPU was completely idle.
This is the typical behavior of Unix programs that expect a list of file
names to process. Most likely, somewhere there's a command like
${AWK} '{print $$0}' ${ALL_PLIST_FILES}
When ${ALL_PLIST_FILES} is empty, the program is executed as follows:
awk '{print $0}'
Which reads from stdin instead of the (empty) list of files.
There are two solutions (for pkgsrc developers):
${AWK} '{print $$0}' /dev/null ${ALL_PLIST_FILES}
This hides some bugs, as an empty PLIST files list is generally
unexpected. The other one is
.if !empty(ALL_PLIST_FILES)
PKG_FAIL_REASON+= "No PLIST files specified."
.else
...
.endif
Roland