fix another errexit bug: unwind() is __dead, so the pseudo-signal was never

delivered to the process
• regression test by Clint Pachl, verified against Debian ksh93 by me
• place to fix it in the code discovered by Otto Moerbeek
This commit is contained in:
tg 2007-07-24 11:22:04 +00:00
parent f2a52c65fa
commit e37577de42
3 changed files with 23 additions and 6 deletions

21
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.129 2007/07/23 14:28:51 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.130 2007/07/24 11:22:03 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 $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R30 2007/07/23
@(#)MIRBSD KSH R30 2007/07/24
description:
Check version of shell.
category: pdksh
@ -3736,6 +3736,23 @@ expected-stderr:
+ /usr/bin/env false
expected-exit: e != 0
---
name: errexit-3
description:
pdksh regression which AT&T ksh does right
TFM says: [set] -e | errexit
Exit (after executing the ERR trap) ...
stdin:
trap 'echo EXIT' EXIT
trap 'echo ERR' ERR
set -e
cd /XXXXX 2>/dev/null
echo DONE
exit 0
expected-stdout:
ERR
EXIT
expected-exit: e != 0
---
name: test-stlt-1
description:
Check that test also can handle string1 < string2 etc.

4
exec.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.36 2007/07/22 14:01:48 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.37 2007/07/24 11:22:04 tg Exp $");
static int comexec(struct op *, struct tbl *volatile, const char **,
int volatile);
@ -362,9 +362,9 @@ execute(struct op *volatile t,
if ((flags&XEXEC))
unwind(LEXIT); /* exit child */
if (rv != 0 && !(flags & XERROK)) {
trapsig(SIGERR_);
if (Flag(FERREXIT))
unwind(LERROR);
trapsig(SIGERR_);
}
return rv;
}

4
sh.h
View File

@ -8,8 +8,8 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.162 2007/07/23 14:28:52 tg Exp $"
#define MKSH_VERSION "R30 2007/07/23"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.163 2007/07/24 11:22:04 tg Exp $"
#define MKSH_VERSION "R30 2007/07/24"
#if HAVE_SYS_PARAM_H
#include <sys/param.h>