summaryrefslogtreecommitdiff
path: root/mk/flavor
diff options
context:
space:
mode:
authorjlam <jlam>2006-06-14 03:00:03 +0000
committerjlam <jlam>2006-06-14 03:00:03 +0000
commit373b4e1f5013a380e541886a1f5af7b343f4d157 (patch)
treeea609582282d19da2f86ee16fcfe4faab699c45e /mk/flavor
parented17e858f142e9d74958e0486e7d2ce8c47dad54 (diff)
downloadpkgsrc-373b4e1f5013a380e541886a1f5af7b343f4d157.tar.gz
Fix error with just-in-time su when installing dependencies. The code
to install dependencies looked roughly like this: ${CAT} ${_DEPENDS_FILE} | while read type pattern dir; do cd $$dir && ${MAKE} install done In the code above, tghe recursive make invoked to install each dependency does a just-in-time su to acquire root privileges for the installation, but the su tries to get terminal settings for standard input (from the pipe) using tcgetattr(), which fails and subsequently causes su to exit with a puzzling "conversation failure" error. Rewrite the loop to look (roughly) like this: set -- `${CAT} ${_DEPENDS_FILE}` while test $# -gt 0; do type=$1; pattern=$2; dir=$3; shift 3 cd $$dir && ${MAKE} install done Note that this is potentially bad for shells with very low limits on the maximum command line length, but at least this preserves file descriptor 1 to reference the controlling tty unless the user does something weird with input redirection when invoking make.
Diffstat (limited to 'mk/flavor')
-rw-r--r--mk/flavor/pkg/depends.mk7
1 files changed, 4 insertions, 3 deletions
diff --git a/mk/flavor/pkg/depends.mk b/mk/flavor/pkg/depends.mk
index 4c6884e90fe..7e9ca172c18 100644
--- a/mk/flavor/pkg/depends.mk
+++ b/mk/flavor/pkg/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.6 2006/06/09 16:41:09 jlam Exp $
+# $NetBSD: depends.mk,v 1.7 2006/06/14 03:00:03 jlam Exp $
_DEPENDS_FILE= ${WRKDIR}/.depends
_REDUCE_DEPENDS_CMD= ${SETENV} CAT=${CAT:Q} \
@@ -67,8 +67,9 @@ ${_DEPENDS_FILE}:
.PHONY: depends-install
depends-install: ${_DEPENDS_FILE}
${_PKG_SILENT}${_PKG_DEBUG}set -e; \
- ${CAT} ${_DEPENDS_FILE} | \
- while read type pattern dir; do \
+ set -- dummy `${CAT} ${_DEPENDS_FILE}`; shift; \
+ while ${TEST} $$# -gt 0; do \
+ type="$$1"; pattern="$$2"; dir="$$3"; shift 3; \
pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \
case "$$pkg" in \
"") \