|
From: | Eric Blake |
Subject: | Re: gzip zgrep-signal failure on Fedora 15 in an Emacs shell window |
Date: | Wed, 02 Nov 2011 14:52:53 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15 |
On 11/02/2011 02:42 PM, Paul Eggert wrote:
While I was at it, I made sure PIPE was SIG_DFL, removing an unwarranted assumption in the current test.
Sorry, but it is not possible in portable shell to reset SIGPIPE to SIG_DFL if the shell itself was started with SIGPIPE as SIG_IGN. That's because POSIX explicitly states that trap is allowed to be a silent no-op on any signal that was inherited as ignored into the shell. You have to resort to an intermediary process (a simple C program or one-liner perl script will do) if you want to ensure that you are invoking a child shell script with SIGPIPE at default handling.
+if (trap - PIPE)>/dev/null 2>&1; then + trap - PIPE
Thus, this does not work to reset SIGPIPE if the shell itself was started with SIGPIPE ignored.
-- Eric Blake address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |