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

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

gzip -q && SIGPIPE


From: Joshua Kronengold
Subject: gzip -q && SIGPIPE
Date: Thu, 27 Oct 2005 17:24:44 -0500

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: 

        -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.

-- 
       Joshua Kronengold (mneme@(io.com, labcats.org)) |\      _,,,--,,_  ,)
--^--  "Remember the Doom Team code!" says Tom.       /,`.-'`'   -,  ;-;;'
 /\\    "You don't have to die just because some      |,4-  ) )-,_ ) /\     
/-\\\   people think your existence is evil!"        '---''(_/--' (_/-'




reply via email to

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