Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

SIGPIPE handling



Zsh and ksh simply dies when they receive an untrapped SIGPIPE signal,
while bash and pdksh catch the signal, and exit with exit status 141.

If you call zsh or bash from a shell script, you'll not notice the
difference, since the shell reports exit status 141 for processes killed
by signal 13 = SIGPIPE, but the status returned by the wait() system call
is different, and for zsh and ksh, WIFSIGNALLED will be true, while for
bash and pdksh WIFEXITED will be true.  Reading the standard
(http://www.rdg.opengroup.org/unix/online.html) it seems to me that the
zsh and ksh behavior is the correct one, since that's the default signal
behavior, and the standard does not mentions that SIGPIPE should be
handled specially (Chet, if you are still reading this list, I'd like to
hear your opinion).

Unoftunately the install-info perl script in Debian relies on the bash
SIGPIPE behavior, hence fails when /bin/sh is zsh or ksh.  The patch
below for the Debian install-info program fixes the problem.  It still
allows the bash behavior.  Someone reported this problem long ago, but
at that time I did not use Debian, and I had no idea what can cause this.
Even now using Debian it took me a while to solve this puzzle.

Zoltan


--- /usr/sbin/install-info.ORIG	Sun Jan 26 01:15:02 1997
+++ /usr/sbin/install-info	Wed Sep  3 02:03:24 1997
@@ -345,7 +345,7 @@
 }
 
 sub checkpipe {
-    return if !$pipeit || !$? || $?==0x8D00;
+    return if !$pipeit || !$? || $?==0x8D00 || $?==0xD;
     die "$name: read $filename: $?\n";
 }
 



Messages sorted by: Reverse Date, Date, Thread, Author