Subject: CVS commit: pkgsrc/mk/flavor/pkg
To: None <>
From: Johnny C. Lam <>
List: pkgsrc-changes
Date: 06/14/2006 03:00:03
Module Name:	pkgsrc
Committed By:	jlam
Date:		Wed Jun 14 03:00:03 UTC 2006

Modified Files:

Log Message:
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

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

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.

To generate a diff of this commit:
cvs rdiff -r1.6 -r1.7 pkgsrc/mk/flavor/pkg/

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.