From e37577de424977a40a2c17f0e34fa41ad7b1067a Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 24 Jul 2007 11:22:04 +0000 Subject: [PATCH] =?UTF-8?q?fix=20another=20errexit=20bug:=20unwind()=20is?= =?UTF-8?q?=20=5F=5Fdead,=20so=20the=20pseudo-signal=20was=20never=20deliv?= =?UTF-8?q?ered=20to=20the=20process=20=E2=80=A2=20regression=20test=20by?= =?UTF-8?q?=20Clint=20Pachl,=20verified=20against=20Debian=20ksh93=20by=20?= =?UTF-8?q?me=20=E2=80=A2=20place=20to=20fix=20it=20in=20the=20code=20disc?= =?UTF-8?q?overed=20by=20Otto=20Moerbeek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.t | 21 +++++++++++++++++++-- exec.c | 4 ++-- sh.h | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/check.t b/check.t index b2cc7ff..2202e39 100644 --- a/check.t +++ b/check.t @@ -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. diff --git a/exec.c b/exec.c index 75dceb7..14a2d0a 100644 --- a/exec.c +++ b/exec.c @@ -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; } diff --git a/sh.h b/sh.h index 0362b84..53d1797 100644 --- a/sh.h +++ b/sh.h @@ -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