Hi Paul. On Monday 12 September 2011, Paul Eggert wrote: > On 09/12/11 05:01, Stefano Lattarini wrote: > > I'd like to know if anyone has an idea of > > what's going on exactly, and how (and if) I can work around it. > > I'd guess it's tail recursion elimination: if the last thing > a Korn shell does is run another program, it bypasses the > fork and does an exec directly. > I don't understand how this is relevant here. The behaviour you're describing does not apply in our situation (there is still an `echo' command after the `perl' command where the SIGINT originates). The problem is that the SIGINT is not being received only by the perl process (as expected), but also by the Korn shell itself!
This example might show the problem more clearly: $ cat foo.sh #!/bin/ksh trap 'echo killed by SIGINIT; exit 99' 2 perl -e 'kill 2, $$; print "hello\n"' /bin/echo dead code $ /bin/ksh foo.sh; echo $? killed by SIGINIT 99 This is clearly a bug (and an horrible one if you ask me). > Also, I'd guess that POSIX allows this behavior. > > Even if POSIX doesn't allow it, it's a nice optimization, > and should be encouraged > But this is completely orthogonal to the issue under discussion. Regards, Stefano