bug-gnulib
[Top][All Lists]
Advanced

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

Re: bash, sed, SIGPIPE


From: Eric Blake
Subject: Re: bash, sed, SIGPIPE
Date: Thu, 01 Jan 2009 17:25:20 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666

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

According to Bruno Haible on 1/1/2009 5:09 PM:
> 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."

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

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

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

iEYEARECAAYFAkldXvAACgkQ84KuGfSFAYBF3ACfTMvLONUhuapQRc3fV2hG6Ojl
b1IAnRyQzLTTusDmHKaJK+P0YtDgm6xT
=2AHO
-----END PGP SIGNATURE-----




reply via email to

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