Op 06-11-16 om 16:52 schreef Chet Ramey: > On 11/6/16 4:08 AM, Martijn Dekker wrote: >> An interactive bash is killed by SIGINT after a command to unset any >> trap for SIGINT. >> >> $ cat >/tmp/dotscript <<EOF >> trap >> trap - INT >> kill -s INT "$$" >> EOF >> $ . /tmp/dotscript >> (no output of 'trap') >> (interactive shell exits) > > You're on a roll finding long-lived bugs this week.
I've been finding various bugs in various shells for some time now: https://github.com/modernish/modernish#appendix-a (and those are just the ones I decided were non-fatal for the purposes of the library). Developing a cross-platform POSIX shell library tends to expose strange and obscure stuff. I've catalogued most of the bugs found with IDs and corresponding bug tests, so scripts can easily check for a bug and work around it. Most of them were fixed for new releases after I reported them (but not the ksh93 ones as ksh93 development appears to be dormant). Unfortunately it would be hard to script a proper bug test for the particular bug reported in this thread, because it only occurs on interactive shells. So, for modernish stack-based traps (which must "unignore" and reissue the signal after executing stack traps if no plain-old-POSIX trap was set, which is how I found this bug) I've had to resort to checking for BASH_VERSION and handling SIGINT specially for interactive bash. But it's really helped that bash turns out to have another unique behaviour: apparently, bash refuses to ignore SIGINT on interactive shells. So, for interactive bash, the workaround is simply to avoid using "trap - INT" to unignore the signal. Thanks, - M.