Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Feb 1998 06:18:44 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, cracauer@cons.org
Cc:        cracauer@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-bin@FreeBSD.ORG, cvs-committers@FreeBSD.ORG
Subject:   Re: cvs commit: src/bin/sh jobs.c
Message-ID:  <199802071918.GAA18082@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802071918.GAA18082>