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
Tue Oct 11 18:11:39 UTC 2005


On Tue, Oct 11, 2005 at 08:47:08PM +0300, Alexander Gattin wrote:
> 
> No, there's only 1 BTW very common issue which does not
> need any fixing IMNSHO.
> 
> Interactive operation works, cmdline operation works.
> What else? Nobody promised operating in semi- or
> improperly emulated interactive modes (proper
> emulation is achieved with expect, python-expect,
> libexpect-perl or alike).

I don't understand why you mention expect.  This program is intended to solve
more complex problems than this one.

> I personally (we all?) didn't see any patch from you,

It's in the bug log.  But it's just a one-liner based on the code lines you
quoted, so it's not really worth searching for it..

> although, well, today _I_ am actually experimenting
> with shadow hacked with my own patches which among
> others include a workaround for this issue you suffer
> from.

That's nice to hear.

> But this insertion of fflush() here and there without
> any defined plan etc. is just chaotic patching/fixing,
> it won't resolve the conceptual issues -- and even with
> "shadow" patched to its furthest limits, you would
> still require to use smth. expect-like for your
> purposes, becaue there are still awk/grep/sed (*) and
> other old good :/ Unix utils besides shadow suite...

These utilities are general purpose and not specificaly intended to obtain
input from the user.  In case a script invokes them with this purpose, it is
the responsability of such script to ensure that question prompts are flushed
out before reading from stdin is attempted.

> (*) http://suxx.kak-sam.to/awkgrep.jpg

Heh, funny.

-- 
Robert Millan
-------------- next part --------------
--- shadow-4.0.12.old/libmisc/fields.c  2005-06-14 22:27:35.000000000 +0200
+++ shadow-4.0.12/libmisc/fields.c      2005-10-11 07:58:57.000000000 +0200
@@ -71,6 +71,7 @@
                maxsize = sizeof (newf);

        printf ("\t%s [%s]: ", prompt, buf);
+       fflush (stdout);
        if (fgets (newf, maxsize, stdin) != newf)
                return;


More information about the Pkg-shadow-devel mailing list