Steffen Daode Nurpmeso found an actual bug:

Whenever the SIGEXIT trap was set (to anything, really)
syntax errors and interruptions were not ignored any more
in an interactive shell (where they should be, unless
set -e is used); fix that.

tbd: traps should probably only be marked as pending
and run for LLEAVE/E_NONE
This commit is contained in:
tg
2013-07-25 18:07:47 +00:00
parent c7f483c16f
commit 3876b38220
3 changed files with 9 additions and 8 deletions

7
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.268 2013/07/21 18:47:19 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.269 2013/07/25 18:07:46 tg Exp $");
extern char **environ;
@ -914,8 +914,9 @@ unwind(int i)
}
/* ordering for EXIT vs ERR is a bit odd (this is what AT&T ksh does) */
if (i == LEXIT ||
((i == LERROR || i == LINTR) && sigtraps[ksh_SIGEXIT].trap)) {
if (i == LEXIT || ((i == LERROR || i == LINTR) &&
sigtraps[ksh_SIGEXIT].trap &&
(!Flag(FTALKING) || Flag(FERREXIT)))) {
++trap_nested;
runtrap(&sigtraps[ksh_SIGEXIT], trap_nested == 1);
--trap_nested;