Bug in yes

"Roger Binns" <[email protected]>
Newsgroups gmane.comp.gnu.sh-utils.bugs
Message-ID <000b01c1f964$30b07100$6401a8c0@rogerb>
If the signals that the yes process inherits have SIGPIPE set to SIG_IGN
then yes will never exit.  What happens is that the write() constantly gets
EPIPE, but ignores it.  The accompanying SIGPIPE is also ignored, and
yes sits there in an infinite loop.

Looking at the yes source, it shows that yes calls ferror() every 1000
iterations.  It would appear that glibc doesn't consider EPIPE on
a stdio stream to be an error.

sh-utils version is 2.0.11 as shipped on Mandrake.  It also happens with
whatever versions are shipped on Redhat 7.1 and 7.2.

A simple fix is to explicitly set SIGPIPE to SIG_DFL in yes.c.

Roger
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.