Subject: pkg/13894: pkgsrc/mk/bsd.pkg.mk portability fix for show-depends-dirs target
To: None <gnats-bugs@gnats.netbsd.org>
From: Stoned Elipot <Stoned.Elipot@script.jussieu.fr>
List: netbsd-bugs
Date: 09/07/2001 17:48:17
>Number:         13894
>Category:       pkg
>Synopsis:       Solaris' /bin/sh does not seems to like a `for' with an empty list
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 07 08:49:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Stoned Elipot
>Release:        pkgsrc-current
>Organization:
SCRIPT, Paris VII University, France
>Environment:
System: SunOS deep-space-9 5.8 Generic_108528-07 sun4u sparc SUNW,Ultra-60
>Description:
Solaris' /bin/sh does not seems to like a `for' with an empty list. When
target show-depends-dirs is called in a pkg source directory and no dependencies
exist the for loop on dependencies as no words list to operate on so /bin/sh
barfs.
>How-To-Repeat:
run bmake show-depends-dirs in say pkgsrc/editors/vim-share on Solaris/Zoularis
>Fix:
the following patch fix this:

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.804
diff -u -r1.804 bsd.pkg.mk
--- bsd.pkg.mk	2001/08/27 15:05:54	1.804
+++ bsd.pkg.mk	2001/09/07 15:38:36
@@ -1286,8 +1286,9 @@
 	${_PKG_SILENT}${_PKG_DEBUG}                                     \
 	dlist="";\
 	thisdir=`pwd`;\
-	for reldir in ${DEPENDS:C/^[^:]*://:C/:.*$//} ${BUILD_DEPENDS:C/^[^:]*://:C/:.*$//} ;\
+	for reldir in ${DEPENDS:C/^[^:]*://:C/:.*$//} ${BUILD_DEPENDS:C/^[^:]*://:C/:.*$//} "" ;\
 	do \
+		if [ "X$$reldir" = X"" ]; then continue; fi;\
 		cd $$thisdir/$$reldir ;\
 		PWD=`pwd` ;\
 		d=`dirname $$PWD` ;\
>Release-Note:
>Audit-Trail:
>Unformatted: