From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id UAA11555 for ; Tue, 26 Nov 1996 20:01:31 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id DAA12027; Tue, 26 Nov 1996 03:46:18 -0500 (EST) Resent-Date: Tue, 26 Nov 1996 03:46:18 -0500 (EST) From: Zefram Message-Id: <1934.199611260846@stone.dcs.warwick.ac.uk> Subject: signal weirdness fix To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Tue, 26 Nov 1996 08:46:51 +0000 (GMT) X-Patch: 136 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8481.82 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"t7DaX.0.rx2.Pvgco"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2480 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- Remember that odd behaviour I reported, that zsh thought it received a signal actually sent to its foreground job? This patch limits it to SIGHUP, SIGINT and SIGQUIT, and disables this behaviour completely in non-interactive shells. I think this is a good semantic. Unfortunately the semantic we actually want (did the signal actually originate at the tty) is impossible to implement, but I think this is a close approximation. -zefram Index: Src/jobs.c =================================================================== RCS file: /home/zefram/usr/cvsroot/zsh/Src/jobs.c,v retrieving revision 1.10 diff -c -r1.10 jobs.c *** Src/jobs.c 1996/11/03 00:48:18 1.10 --- Src/jobs.c 1996/11/26 00:01:11 *************** *** 180,194 **** /* WHY DO WE USE THE RETURN STATUS OF PROCESS GROUP LEADER HERE? */ /* If the foreground job got a signal, pretend we got it, too. */ ! if (inforeground && WIFSIGNALED(status)) { ! if (sigtrapped[WTERMSIG(status)]) { /* Run the trap with the error flag unset. * Errflag is set in printjobs if the jobs terminated * with SIGINT. I don't know why it's done there and * not here. (PWS 1995/06/08) */ errflag = 0; ! dotrap(WTERMSIG(status)); /* We keep the errflag as set or not by dotrap. * This is to fulfil the promise to carry on * with the jobs if trap returns zero. --- 180,198 ---- /* WHY DO WE USE THE RETURN STATUS OF PROCESS GROUP LEADER HERE? */ /* If the foreground job got a signal, pretend we got it, too. */ ! if (inforeground && interact && WIFSIGNALED(status)) { ! int sig = WTERMSIG(status); ! ! if(sig != SIGHUP && sig != SIGINT && sig != SIGQUIT) ! ; ! else if (sigtrapped[sig]) { /* Run the trap with the error flag unset. * Errflag is set in printjobs if the jobs terminated * with SIGINT. I don't know why it's done there and * not here. (PWS 1995/06/08) */ errflag = 0; ! dotrap(sig); /* We keep the errflag as set or not by dotrap. * This is to fulfil the promise to carry on * with the jobs if trap returns zero. *************** *** 198,205 **** */ if (errflag) breaks = loops; ! } else if (WTERMSIG(status) == SIGINT || ! WTERMSIG(status) == SIGQUIT) { breaks = loops; errflag = 1; } --- 202,208 ---- */ if (errflag) breaks = loops; ! } else if (sig == SIGINT || sig == SIGQUIT) { breaks = loops; errflag = 1; } -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBMpo0q3D/+HJTpU/hAQFClQP/XBLb4IYMjcCmXc+7jneECAAcHJZvNs22 Yoa2gxrdSM78jHj1NUHN3V78LAqF6wITB5bspgT5sJ1hfyBlR+eQSvKd0imyDi9M 4YxtkUCaDX/GZLU+wiws4GSD7DsCD4c2yiAC+B8WlZ4WXGCKy8r++9h5DVIn4K1p HoA+C4q4IR4= =QpBl -----END PGP SIGNATURE-----