bug-gnulib
[Top][All Lists]
Advanced

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

Re: bash, sed, SIGPIPE


From: Bruno Haible
Subject: Re: bash, sed, SIGPIPE
Date: Fri, 2 Jan 2009 02:44:37 +0100
User-agent: KMail/1.9.9

Eric Blake wrote in 
<http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00007.html>:
> > After 'trap - SIGPIPE', sed should get a fatal SIGPIPE signal in these 
> > conditions.
> > Quoting 
> > <http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap>
> >
> >   "If action is '-' , the shell shall reset each condition to the default 
> > value."
> 
> You're missing one other piece.
> 
> "Signals that were ignored on entry to a non-interactive shell cannot be
> trapped or reset, although no error need be reported when attempting to do
> so."

Is the culprit then the line 263 of build-aux/bootstrap, or is it in Jim's
environment?

> Therefore, if a bash script is started while SIGPIPE is already ignored,
> there is nothing the script can do to turn it off ('trap - SIGPIPE' only
> re-enables default behavior if your script was the one that disabled it in
> the first place, but not if your script started with it already disabled).

Then, I would say, we need a new program in GNU coreutils, that allows to
run a command with the SIGPIPE signal not ignored and its handler set to
SIG_DFL. Possible syntax:

  notrap 13 command...

(Similar to nohup.)

Bruno




reply via email to

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