Subject: pkg/31265: mk/scripts/mkreadme needs to handle large file lists more intelligently
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <stuart@zeus.com>
List: pkgsrc-bugs
Date: 09/09/2005 07:57:53
>Number:         31265
>Category:       pkg
>Synopsis:       mk/scripts/mkreadme needs to handle large file lists more intelligently
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 09 07:57:53 +0000 2005
>Originator:     Stuart Shelton
>Release:        n/a
>Organization:
n/a
>Environment:
IRIX64 octane 6.5 07010238 IP30 mips: IRIX 6.5.28
>Description:
mk/scripts/mkreadme appears to have a couple of problems:

* It ignores an environment or mk.conf setting for $AWK
* In a couple of places it does "grep */*"-type operations, which fail with a "arg list too long" error.

The latter can be easily fixed by using ${FIND} or "for" to break up the list of files into manageable chunks.

As a suggestion for an enhancement, wouldn't it be a good idea to check for the current number of command-line arguments allowed to try to identify OS/installations likely to hit problems?  On IRIX this is "getconf ARG_MAX" - which outputs the number of allowed arguments without and additional characters or spaces.
>How-To-Repeat:
bmake readme
>Fix:

I'd propose something similar to altering line 422 to read:

cat /dev/null > $ipv6
for FILE in */*/Makefile */*/options.mk; do
    ${GREP} -l -e '^BUILD_DEFS.*=.*USE_INET6' -e '^PKG_SUPPORTED_OPTIONS.*=.*inet6' $FILE | ${SED} -e 's;Makefile;;g' -e 's;options.mk;;g' >> $ipv6
done

... and changing lines 451-452 to:

    for d in `${FIND} -type d -maxdepth 2` ; do
        if [ ! -f ${d}/Makefile -a -f ${d}/README.html ]; then