diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 805a4aee0..474961b93 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -2523,7 +2523,7 @@ int sh_exec(register const Shnode_t *t, int flags) sh_popcontext(chkp); enter_namespace(oldnspace); if(jmpval) /* error occurred */ - sh_exit(sh.exitval); + siglongjmp(*sh.jmplist,jmpval); break; } #endif /* SHOPT_NAMESPACE */ diff --git a/src/cmd/ksh93/tests/namespace.sh b/src/cmd/ksh93/tests/namespace.sh index 5c5978345..74d30d35d 100755 --- a/src/cmd/ksh93/tests/namespace.sh +++ b/src/cmd/ksh93/tests/namespace.sh @@ -133,11 +133,8 @@ set +o allexport # ====== # A namespace's parent scope should be restored after an error occurs. # https://github.com/ksh93/ksh/issues/479#issuecomment-1140514159 -# -# TODO: this test fails when run in a non-forking comsub: the trap -# is not executed -- the zillionth bug with virtual subshells >:-/ exp=$'123 456\n789 456' -got=$(ulimit -t unlimited 2>/dev/null # workaround: force fork +got=$( trap 'echo $x ${.test.x}; x=789; echo $x ${.test.x}' EXIT x=123 namespace test