The bug concerned the EXIT pseudosignal. But, apparently, mksh does not
execute subshell-specific traps for real signals either:
$ mksh -c '(trap "echo int_subsh" INT; kill -s INT $BASHPID); echo end'
end
$ bash -c '(trap "echo int_subsh" INT; kill -s INT $BASHPID); echo end'
int_subsh
end
Same with other signals, such as TERM.
POSIX specifies that traps are cleared in subshells, but not that new
traps should not be executed.
(background note for other readers: in both mksh and bash, but in no
other shell that I know of, $BASHPID denotes the PID of the current
subshell, as opposed to $$ which always refers to the main shell)
- M.