Subject: pkg/5780: binpkg-list rule is 10x wasteful on some setups
To: None <>
From: None <>
List: netbsd-bugs
Date: 07/17/1998 02:29:30
>Number:         5780
>Category:       pkg
>Synopsis:       binpkg-list rule is wasteful on some archs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 17 00:35:00 1998
>Originator:     Brian Grayson
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        July 13, 1998
NetBSD marvin 1.3E NetBSD 1.3E (MARVIN) #40: Thu Jun  4 09:11:48 CDT 1998     bgrayson@marvin:/a/c3p0/home/c3p0/src/sys/arch/i386/compile/MARVIN i386

	On x86, doing `make readme' in /usr/pkgsrc runs at a
	dreadful pace.  Top showed that building each README.html
	was requiring 800(!) processes.  A little investigation
	showed that the cause is the rule for binpkg-list, in
	/usr/pkgsrc/mk/  Here are the relevant
PACKAGES?=              ${PKGSRCDIR}/packages
# The following assumes that PACKAGES is set like the following:
# PACKAGES= /usr/pkgsrc/packages/`uname -r`/${MACHINE_ARCH}
# i.e. contain OS version and arch name as subdirs
.if !target(binpkg-list)
        @cd ${PACKAGES}/../.. ; \
        for i in */* ; \
        do \

	The result:  on an x86 box where PACKAGES isn't
otherwise defined, it is set to /usr/src/pkgsrc/packages (on
my system, where /usr/pkgsrc is a symlink to /usr/src/pkgsrc).  The
for i statement then looks at /usr/src/*/*, and does the -f
test on every file.  Needless to say, there are a whole lot of
subdirectories in /usr/src/*.

	(Is there a reason test/[ is not a /bin/sh builtin?)

	After removing the /../.. above, it only took around 85
processes to create a single README.html.  (I was using
archivers/lha as my test case).  I used something along the lines of:
sh -c 'echo $$';make README.html;sh -c 'echo $$', and compared the
printed pids.  Nothing else was running at the time.

	I am not sure what the right thing to do is.  Perhaps
PACKAGES?= ${PKGSRCDIR}/packages/`uname -r`${MACHINE_ARCH} as suggested?