[Pkg-shadow-devel] Bug#333138: marked as forwarded (chfn behaves
bogusly when either fd 0, 1 or 2 is not a tty)
Robert Millan
rmh at aybabtu.com
Thu Oct 13 07:36:15 UTC 2005
On Tue, Oct 11, 2005 at 10:17:20PM +0300, Alexander Gattin wrote:
> > The problem with this one is that when it's being
> > called indirectly by adduser,
> > then your script has no control over it.
>
> Sorry, I don't understand -- I always thought adduser
> calls (let's take) chfn passing all info to it on
> cmdline.
Ok, I think it's worth illustrating my problem better.
I'm building an image of Ging (http://glibc-bsd.alioth.debian.org/ging/).
The first step involves using a customised script (tarball.sh) that invokes
crosshurd's internal makehurddir.sh. The result is that after half an hour
of fetching packages and configuring them, the script invokes "adduser" to
create the ging user account. This usualy works fine.
The other day (just before I filed this bug), however, I was debugging a problem
in tarball.sh, and issued:
$ ./tarball.sh 2>&1 | tee /tmp/log
The result of this being that at some point, the script appears to hang.
There's no output in stdout/stderr indicating that this is a prompt. Pressing
"enter" a few times apparently does nothing, so this leaves me totaly puzzled.
Since tarball.sh wasn't using "set -x", I had to run ps and poke around the
process list to figure out which was the "hanged" process.
As you can see, there's no way I can pass all the info to chfn on the command
line. All I can do untill you fix this bug is live with a script that doesn't
support redirection of stderr.
> > I've tested it with:
> >
> > # cat | chfn rmh 2>&1 | cat
>
> Today this woks, tomorrow you will need smth. slightly
> different and it will break in some other place.
This is how the buffer looks at every time when fflush is called:
Changing the user information for $user
Enter the new value, or press ENTER for the default
Full Name [$user]:
!!! fflush
Room Number []:
!!! fflush
Work Phone []:
!!! fflush
Home Phone []:
!!! fflush
Other []:
!!! fflush
I think it's fine. An fflush just each time you expect input from the user.
Why do you say this is subject to breaking in the future?
--
Robert Millan
More information about the Pkg-shadow-devel
mailing list