Subject: Re: root password prompt fails
To: Adrian Portelli <adrianp@stindustries.net>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: pkgsrc-users
Date: 06/14/2006 02:12:21
On Tue, Jun 13, 2006 at 10:36:45PM +0100, Adrian Portelli wrote:
> oliver gould wrote:
> > On Tue, Jun 13, 2006 at 20:47:00, Adrian Portelli wrote:
> >> Matthias Drochner wrote:
> >>> Do you get this too (on -current)?
> >>> This is new, it used to work a week ago or so.
> >>>
> >>>
> >>> ===> Installing for gst-plugins0.10-ugly-0.10.3
> >>> => Becoming ``root'' to make su-install-all (/usr/bin/su)
> >>> su: Sorry: conversation failure
> >>> *** Error code 1
> >>>
> >>>
> >>> best regards
> >>> Matthias
> >>>
> >>>
> >>>
> >> During a "make replace" by chance ?
> > 
> > I noticed the same thing doing a normal `make' when a dependancy needs
> > to be installed.
> > 
> 
> I think I've seen it when doing a "make replace" which then pulls in
> additional dependencies.  I'll have to take a further look into this.

[NOTE: Moved to tech-pkg.  Please post replies on tech-pkg.]

I've figured out why this happens.  Part of my changes in the last
few weeks have been to remove some "for i in `prog`" loops and replace
them with "prog | while read i" instead.  One place this happened was
in the dependency handling in pkgsrc/mk/flavor/depends.mk, and
paraphrasing the code, it looks like:

	${CAT} ${_DEPENDS_FILE} |
	while read type pattern dir; do
		cd $$dir && ${MAKE} install
	done

The "install" target 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() and fails, which
causes su to exit with the puzzling "conversation failure" error.

I will rewrite the loop to avoid this issue, but this is definitely
something to keep in mind.  The error was definitely non-obvious, and
there are several other places in the code where one can potentially
invoke a target that does a just-in-time su.  I'm trying to figure
out a general rule we can follow in pkgsrc/mk to avoid these situations
altogether.  Perhaps we should just avoid pipes in places where we can
invoke a recursive make?

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>