bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yesno module consumes too much input


From: Eric Blake
Subject: Re: yesno module consumes too much input
Date: Sat, 18 Aug 2007 12:21:24 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 8/18/2007 10:34 AM:
> According to Paul Eggert on 8/17/2007 5:43 PM:
>> Eric Blake-1 <address@hidden> writes:
> 
>>> is it reasonable to have yesno install an atexit
>>> handler on first invocation?  If the handler is not present,
>>> then stdin was never used (at least not by yesno).
>> Yes, that sounds reasonable to me.
> 
> How about the following patch?  Tested on Linux, including that test-yesno
> detected failure prior to the yesno.c patch.

Note that in testing this patch, I found another category of problems that
it serendipitously fixes (as in, read errors should always cause a
non-zero exit, but closed stdin is only an issue if it was read from):

pre-patch:
$ touch foo
$ rm -i foo <&-; echo $?
rm: remove regular empty file `foo'? 0
$ ls foo
foo

post-patch:
$ touch foo
$ rm -i foo <&-; echo $?
rm: remove regular empty file `foo'? rm: error closing file: Bad file
descriptor
1
$ ls foo
foo
$ rm foo <&-; echo $?
0

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxzij84KuGfSFAYARAsO8AKDGpqGx4+/XXlAbKF7K9yXHbV7KzgCdHSnD
h2r2pauITvHuA86e/mQiCiI=
=15VS
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]