bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gzip -q && SIGPIPE


From: Paul Eggert
Subject: Re: gzip -q && SIGPIPE
Date: Fri, 28 Oct 2005 15:49:28 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Joshua Kronengold <address@hidden> writes:

> gzip's -q switch is intended to avoid emitting on a SIGPIPE.
>
> However, this behavior itself relies on the behavior of the signal
> handler -- if SIGPIPE is set to IGNORE, it will not be used.
>
> Thisi s horribly broken (causing spurious errors when truncating gzip
> reads, thus making it impossible to treat every gzip emit/failure as a
> serious error condition) -- because gzip, in addition to dying from
> SIGPIPE signals, will -also- exit with "broken pipe" if it recieves a
> PIPE error from a file write.
>
> Solution: exit silently on PIPE errors if either SIGPIPE is set or -q
> is set.  If a PIPE error contition is a true error, it will accompany
> a SIGPIPE, and we will die.  The only times we will ever -see- a PIPE
> error is under two conditons: 

Sorry, I don't understand this bug report.  Among other things I don't
know what you mean by "SIGPIPE is set".  Can you illustrate it with a
realistic example?

>       -q is set, SIGPIPE is ignore: non-error EOF.  exit 0.
>
>       -q is not set, SIGPIPE is ingore: presumably, the setting of
>       -SIGPIPE as ignore means sigpipes should be ignored.  exit 0.

But typically, if SIGPIPE is ignored programs report the underlying
pipe error.  For example:

   $ trap '' PIPE
   $ cat /etc/motd | :
   cat: write error: Broken pipe

I don't offhand see why gzip should behave differently from 'cat' here.




reply via email to

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