* Dmitry V. Levin wrote on Sun, Jan 31, 2010 at 01:04:01PM CET: > On Sun, Jan 31, 2010 at 08:05:20AM +0100, Ralf Wildenhues wrote: > > Can you please explain whose fault this is? Is that a kernel issue, a > > shell issue, or expected behavior given a POSIX system? > > It is expected behaviour.
> > What are the "other cases" > > you mention, where no process was terminated by the signal, but the > > signal delivered somewhere nonethess? > > A moment when the signal can be delivered to the shell process is not > necessarily the moment when an external command is executed. The signal > can be delivered when a builtin is executed, or even when nothing is > executed yet. In this case, the exit status of the last command run > before the trap has nothing related to the just delivered signal. Thanks for the explanation. As I understand SUSv3, the same should hold for builtin commands as for external ones. But I agree that nothing may be executed, and there is no limitation for $? then. However, SIGINT should not cause 128+TERM, so it would be more precise to exit with a status that reflected the actual signal given, similar to how configure scripts adjust the per-signal trap, for the scripts which have more than one signal trapped. Thanks, Ralf
