From owner-cvs-all Sat Feb 7 11:20:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA17249 for cvs-all-outgoing; Sat, 7 Feb 1998 11:20:20 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA17235; Sat, 7 Feb 1998 11:20:16 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id GAA18082; Sun, 8 Feb 1998 06:18:44 +1100 Date: Sun, 8 Feb 1998 06:18:44 +1100 From: Bruce Evans Message-Id: <199802071918.GAA18082@godzilla.zeta.org.au> To: bde@zeta.org.au, cracauer@cons.org Subject: Re: cvs commit: src/bin/sh jobs.c Cc: cracauer@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-bin@FreeBSD.ORG, cvs-committers@FreeBSD.ORG Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe cvs-all" >Another difference with subshells. While your versions runs the first >test fine (shell doesn't exit while emacs runs, but is interruptable >afterwards), it fails on the second, the script is terminated when >SIGINT is delivered to emacs. The problem here is that it doesn't >always ignore before it forks a foreground process. > >#!./testshell >./emacs -nw >while : ; do foo=1 ; done > > >#!./testshell >( > ( > ./emacs -nw > while : ; do foo=1 ; done > ) > while : ; do foo=1 ; done >) >while : ; do foo=1 ; done My version doesn't change the behaviour of subshells. sh does extra work to reset the signals in the subshell. This was easy to "fix" by removing the test for rootshell in setsignal(), except that breaks my hack for resetting SIGINT to get the correct exit status. Here is another bug: #!/bin/sh set -x trap 'echo t' 2 while : ; do (echo 1; cat); echo $?; done The subshell is optimized away, although this isn't valid because the trap should be reset in the subshell. Bruce