From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5945 invoked from network); 18 May 1997 19:04:57 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 18 May 1997 19:04:57 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA20499; Sun, 18 May 1997 14:58:08 -0400 (EDT) Resent-Date: Sun, 18 May 1997 14:58:08 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199705181900.PAA01451@hzoli.home> Subject: SIGPIPE handling To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Sun, 18 May 1997 15:00:33 -0400 (EDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"54a7l1.0.E05.05rVp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3157 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Since it seems that noone know why SIGPIPE is trapped for shells under job control, let's try to remove this. This change only affects interactive shells since when MONITOR is not set SIGPIPE is not handled specially. And since SIGPIPE is not related to process groups and not used for job control, it should not be a special case. Probably it was just an oversight when some developer thought that SIGPIPE is in the same category as SIGT{OU,IN,STP} signals. SIGPIPE is still not reported after this patch. In bash, cat builtin.c | : reports `Broken pipe' while zsh and ksh and pdksh remains silent, which is better I think. This patch should be applied to zsh-3.0 as well. The jobs.c hunk will be rejected. Just apply this rejected patch to builtin.c using patch builtin.c jobs.c.rej Alternatively you can edit the patch and replace jobs.c with builtin.c. Zoltan *** Src/signals.c 1997/05/18 09:04:56 3.1.2.5 --- Src/signals.c 1997/05/18 18:38:40 *************** *** 590,597 **** { if (sig == -1) return 1; ! if (jobbing && (sig == SIGTTOU || sig == SIGTSTP || ! sig == SIGTTIN || sig == SIGPIPE)) { zerr("can't trap SIG%s in interactive shells", sigs[sig], 0); return 1; } --- 590,596 ---- { if (sig == -1) return 1; ! if (jobbing && (sig == SIGTTOU || sig == SIGTSTP || sig == SIGTTIN)) { zerr("can't trap SIG%s in interactive shells", sigs[sig], 0); return 1; } *************** *** 625,632 **** int trapped; if (sig == -1 || !(trapped = sigtrapped[sig]) || ! (jobbing && (sig == SIGTTOU || sig == SIGTSTP || ! sig == SIGTTIN || sig == SIGPIPE))) { return; } sigtrapped[sig] = 0; --- 624,630 ---- int trapped; if (sig == -1 || !(trapped = sigtrapped[sig]) || ! (jobbing && (sig == SIGTTOU || sig == SIGTSTP || sig == SIGTTIN))) { return; } sigtrapped[sig] = 0; *** Src/jobs.c 1997/05/18 09:09:03 3.1.2.4 --- Src/jobs.c 1997/05/18 18:36:33 *************** *** 1270,1276 **** } if (jobbing) { /* stop ignoring signals */ - signal_default(SIGPIPE); signal_default(SIGTTIN); signal_default(SIGTSTP); signal_default(SIGTTOU); --- 1270,1275 ---- *************** *** 1288,1294 **** signal_ignore(SIGTTOU); signal_ignore(SIGTSTP); signal_ignore(SIGTTIN); - signal_ignore(SIGPIPE); } return 0; } --- 1287,1292 ---- *** Src/init.c 1997/05/18 09:09:03 3.1.2.11 --- Src/init.c 1997/05/18 18:38:57 *************** *** 588,594 **** signal_ignore(SIGTTOU); signal_ignore(SIGTSTP); signal_ignore(SIGTTIN); - signal_ignore(SIGPIPE); attachtty(mypgrp); } } --- 588,593 ---- *** Src/exec.c 1997/05/18 09:04:56 3.1.2.9 --- Src/exec.c 1997/05/18 18:39:06 *************** *** 1936,1942 **** signal_default(SIGTTOU); signal_default(SIGTTIN); signal_default(SIGTSTP); - signal_default(SIGPIPE); } if (interact) { signal_default(SIGTERM); --- 1936,1941 ----