Bug#333138: [Pkg-shadow-devel] Bug#333138: chfn behaves bogusly when either fd 0, 1 or 2 is not a tty

Robert Millan rmh at aybabtu.com
Mon Oct 10 19:28:24 UTC 2005


On Mon, Oct 10, 2005 at 08:08:01PM +0200, Christian Perrier wrote:
> > Package: passwd
> > Version: 1:4.0.3-39
> > Severity: normal
> 
> Testing with 4.0.13 (next version). Should be the same with 4.0.12
> (the version in unstable and Wednesday in testing):

Sorry, my sid is a bit outdated :)

> > aragorn:~# chfn rmh
> > Changing the user information for rmh
> > Enter the new value, or press ENTER for the default
> >         Full Name [rmh]:^C
> > aragorn:~# cat | chfn rmh
> > Changing the user information for rmh
> > Enter the new value, or press ENTER for the default
> > ^C
> 
> If you enter "something" here, even on more than 1 line, then chfn
> will do what's advertised and change informations:

Ok, but why wasn't "        Full Name [rmh]:" printed? they're just standard
characters; they don't really need a terminal to be output.  I suspect there's
a bogus isatty() check or something.

> > aragorn:~# chfn rmh | cat
> > ^C
> 
> No idea what you're actually trying to do here...
> 
> 
> > aragorn:~# chfn rmh 2>&1 | cat
> > ^C
> 
> Same here

This was just a test.  When I found the problem, I was running chfn as part of a
script, and redirecting stderr of the parent shell like this:

  script 2>&1 | tee /tmp/log

In this situation, this bug is very annoying, because your script suddenly hangs
and you don't know what's going on (unless you were using "set -x" of course).

Thanks,

-- 
Robert Millan




More information about the Pkg-shadow-devel mailing list