Subject: pkg/35294: mk/flavor/pkg/depends.mk can output incorrect dependencies on Irix
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <fanch@kekpar.net>
List: pkgsrc-bugs
Date: 12/20/2006 10:20:01
>Number:         35294
>Category:       pkg
>Synopsis:       mk/flavor/pkg/depends.mk can output incorrect dependencies on Irix
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 10:20:01 +0000 2006
>Originator:     Francois Brunel
>Release:        pkgsrc-2006Q3
>Organization:
>Environment:
IP30
Irix 6.5.30
MIPSPro 7.4.1m
ABI=32
>Description:
When a dependency of the form:

{ghostscript,ghostscript-afpl,ghostscript-esp,ghostscript-gnu}>=6.01 ../../print/ghostscript-gnu

is encountered, shell replacement occurs on Irix at various places and
gives:

ghostscript>=6.01 ../../print/ghostscript-gnu
ghostscript-afpl>=6.01 ../../print/ghostscript-gnu
ghostscript-esp>=6.01 ../../print/ghostscript-gnu
ghostscript-gnu>=6.01 ../../print/ghostscript-gnu

It appears while building (for example) textproc/groff in .depends_done
So groff is not buildable on Irix.

The following patch corrects this issue, but the sed part isn't IMO
the right thing to do.

>How-To-Repeat:

>Fix:
--- depends.mk.orig	2006-12-20 07:44:04.118052480 +0100
+++ depends.mk
@@ -54,8 +54,8 @@ ${_DEPENDS_FILE}:
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} |				\
 	while read dep; do						\
-		pattern=`${ECHO} $$dep | ${SED} -e "s,:.*,,"`;		\
-		dir=`${ECHO} $$dep | ${SED} -e "s,.*:,,"`;		\
+		pattern=`${ECHO} "$$dep" | ${SED} -e "s,:.*,,"`;	\
+		dir=`${ECHO} "$$dep" | ${SED} -e "s,.*:,,"`;		\
 		${TEST} -n "$$pattern" || exit 1;			\
 		${TEST} -n "$$dir" || exit 1;				\
 		${ECHO} "full	$$pattern	$$dir";			\
@@ -69,9 +69,11 @@ ${_DEPENDS_FILE}:
 .PHONY: depends-install
 depends-install: ${_DEPENDS_FILE}
 	${_PKG_SILENT}${_PKG_DEBUG}set -e;				\
-	set -- dummy `${CAT} ${_DEPENDS_FILE}`; shift;			\
+	set -- dummy `${CAT} ${_DEPENDS_FILE} | ${SED} -e "s,{,(,;s,},),"`; shift;		\
 	while ${TEST} $$# -gt 0; do					\
-		type="$$1"; pattern="$$2"; dir="$$3"; shift 3;		\
+		type="$$1";						\
+		pattern=`${ECHO} "$$2" | ${SED} -e "s,(,{,;s,),},"`;	\
+		dir="$$3"; shift 3;					\
 		silent=;						\
 		${_DEPENDS_INSTALL_CMD};				\
 	done