Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Monday 12 September 2011, Stefano Lattarini wrote: > On Monday 12 September 2011, Stefano Lattarini wrote: > > > > The "default" Korn Shell on Debian GNU/Linux (package `ksh', version > > `93u-1') seems to exhibit the same issue. > > > > And if I'm not reading the strace output wrong, this is

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Monday 12 September 2011, Paul Eggert wrote: > On 09/12/11 13:03, Stefano Lattarini wrote: > >> > It's just that this trick doesn't work for the shell itself, > >> > at least, it doesn't always work in the presence of traps. > >> > > > So you basically agree with my opinion? > > I agree that i

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Paul Eggert
On 09/12/11 13:03, Stefano Lattarini wrote: >> > It's just that this trick doesn't work for the shell itself, >> > at least, it doesn't always work in the presence of traps. >> > > So you basically agree with my opinion? I agree that it's a problem with ksh's behavior. I'm not sure that it violat

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Monday 12 September 2011, Paul Eggert wrote: > On 09/12/11 11:17, Stefano Lattarini wrote: > > this is due to the fact > > that the Debian korn shell is apparently killing itself (yikes!) with the > > same signal that killed the child process: > > That's actually a fairly standard trick, one th

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Monday 12 September 2011, Stefano Lattarini wrote: > Now some updates: the "default" Korn Shell on Debian GNU/Linux (package > `ksh', version `93u-1') seems to exhibit the same issue: > > $ ksh -c "perl -e 'kill 2, \$\$'; :"; echo $? > 130 > > And if I'm not reading the strace output wrong,

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Monday 12 September 2011, Paul Eggert wrote: > On 09/12/11 09:19, Stefano Lattarini wrote: > > > This example might show the problem more clearly: > > Yes, thanks, that does clarify matters, and my guesses seem > incorrect. It does seem that ksh's behavior (in your last > example, anyway) vio

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Paul Eggert
On 09/12/11 09:19, Stefano Lattarini wrote: > This example might show the problem more clearly: Yes, thanks, that does clarify matters, and my guesses seem incorrect. It does seem that ksh's behavior (in your last example, anyway) violates POSIX

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
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

Re: On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Paul Eggert
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 dir

On solaris, a SIGINT sent to a child process of Korn Shell kills the shell itself

2011-09-12 Thread Stefano Lattarini
On Solaris 10, I'm observing this: $ cmd="perl -e 'kill 2, \$\$; exit 0'; echo alive" $ bash -c "$cmd"; echo $? alive 0 $ dash -c "$cmd"; echo $? alive 0 $ /bin/sh -c "$cmd"; echo $? alive 0 $ /bin/ksh -c "$cmd"; echo $? 130 $ /usr/xpg4/bin/sh -c "$cmd"; echo $? 130 I think this hor