Subject: pkg/36218: su-install-all fails: STDIN redirected from file
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <gathorpe79@yahoo.com>
List: pkgsrc-bugs
Date: 04/25/2007 19:20:01
>Number:         36218
>Category:       pkg
>Synopsis:       su-install-all fails: STDIN redirected from file
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 25 19:20:01 +0000 2007
>Originator:     Gary Thorpe
>Release:        3.0
>Organization:
>Environment:
NetBSD rider.elven.org 3.0 NetBSD 3.0 (RIDER) #13: Thu Mar  8 22:36:48 EST 2007  gthorpe@rider.elven.org:/misc/sysbuilds/RIDER i386
>Description:
Doing an unpriviledged build of any package fails when building dependencies: su always fails because STDIN has been redirected from a file to read dependencies.

This produces errors like:

rider 45% make
=> Required installed package digest>=20010302: digest-20060826 found
===> Checking for vulnerabilities in dillo-0.8.6nb1
=> Checksum SHA1 OK for dillo-0.8.6.tar.bz2
=> Checksum RMD160 OK for dillo-0.8.6.tar.bz2
===> Installing dependencies for dillo-0.8.6nb1
==========================================================================
The supported build options for dillo are:

        dillo-ssl inet6

The currently selected options are:

        inet6

You can select which build options to use by setting PKG_DEFAULT_OPTIONS
or the following variable.  Its current value is shown:

        PKG_OPTIONS.dillo (not defined)

Deprecated variable USE_INET6 set to YES, use PKG_DEFAULT_OPTIONS+=inet6 instead.

==========================================================================
=> Required installed package digest>=20010302: digest-20060826 found
=> Required installed package x11-links>=0.25: x11-links-0.30 found
=> Required installed package jpeg>=6bnb2: NOT found
=> Verifying package for ../../graphics/jpeg
[...]
=> Unwrapping files-to-be-installed.
===> Installing for jpeg-6bnb3
=> Becoming ``root'' to make su-install-all (/usr/bin/su)
su: Sorry: conversation failure
*** Error code 1

Stop.
make: stopped in /misc/pkgsrc/graphics/jpeg
*** Error code 1

Stop.
make: stopped in /misc/pkgsrc/graphics/jpeg
*** Error code 1

Stop.
make: stopped in /misc/pkgsrc/www/dillo
>How-To-Repeat:
Build any package which needs to also build dependencies as an unpriviledged user (needs to run 'su').
>Fix:
This patch from OBATA Akio fixes the problem:

===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/depends.mk,v
retrieving revision 1.26
diff -u -r1.26 depends.mk
--- depends.mk  19 Mar 2007 16:43:59 -0000      1.26
+++ depends.mk  25 Apr 2007 18:55:02 -0000
@@ -72,12 +72,14 @@
 #
 _flavor-install-dependencies: .PHONY ${_DEPENDS_FILE}
        ${RUN}                                                          \
+       exec 3<&0;                                                      \
        while read type pattern dir rest; do                            \
                { [ "$$dir" ] && [ ! "$$rest" ]; }                      \
                || ${FAIL_MSG} "[depends.mk] Internal error #1: Check ${_DEPENDS_FILE}"; \
                silent=;                                                \
-               ${_DEPENDS_INSTALL_CMD};                                \
+               ${_DEPENDS_INSTALL_CMD} <&3;                            \
        done < ${_DEPENDS_FILE}
+

 ######################################################################
 ### bootstrap-depends (PUBLIC, pkgsrc/mk/depends/depends.mk)