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

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.623 2013/07/25 16:41:30 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.624 2013/07/25 18:07:44 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -31,7 +31,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R47 2013/07/24
@(#)MIRBSD KSH R47 2013/07/25
description:
Check version of shell.
stdin:
@ -40,7 +40,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R47 2013/07/24
@(#)LEGACY KSH R47 2013/07/25
description:
Check version of legacy shell.
stdin:

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;

4
sh.h
View File

@ -164,9 +164,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.661 2013/07/24 18:03:57 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.662 2013/07/25 18:07:47 tg Exp $");
#endif
#define MKSH_VERSION "R47 2013/07/24"
#define MKSH_VERSION "R47 2013/07/25"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES