zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: SIGPIPE handling
Date: Sun, 18 May 1997 15:00:33 -0400 (EDT)	[thread overview]
Message-ID: <199705181900.PAA01451@hzoli.home> (raw)

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


             reply	other threads:[~1997-05-18 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-18 19:00 Zoltan Hidvegi [this message]
1997-09-03  6:17 Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199705181900.PAA01451@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).