partial merge and full RCS ID sync with oksh
merged: • new regression tests • check.pl (tests/th) better tmpfile handling • exec.c 1.50: POSIX specifies that for an AND/OR list, only the last command's exit status matters for "set -e" • ksh.1 1.147: document the above • eval.c 1.39: “Make $(< /nonexistent) have the same behaviour as $(cat /nonexistent) wrt. errors (do not unwind and do not treat this as fatal if set -e is used).” ‣ additionally make shf_open() return errno and actually show the error message from the system • regression-39 test: remove the “maybe” marker ‣ but decide on correct POSIX behaviour already been fixed in mksh: • check.pl (tests/th) exit 1 if tests fail not merged: • main.c 1.52: run traps in unwind() before exiting; I’m pretty sure this is already working as-should in mksh • eval.c 1.38: “Commands executed via `foo` or $( bar ) should not inherit "set -e" status.” As discussed in IRC, this is just plainly WRONG.
This commit is contained in:
14
exec.c
14
exec.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: exec.c,v 1.49 2009/01/29 23:27:26 jaredy Exp $ */
|
||||
/* $OpenBSD: exec.c,v 1.50 2013/06/10 21:09:27 millert Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.122 2013/06/03 22:28:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.123 2013/07/21 18:36:00 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||
@ -302,10 +302,12 @@ execute(struct op * volatile t,
|
||||
case TAND:
|
||||
rv = execute(t->left, XERROK, xerrok);
|
||||
if ((rv == 0) == (t->type == TAND))
|
||||
rv = execute(t->right, XERROK, xerrok);
|
||||
flags |= XERROK;
|
||||
if (xerrok)
|
||||
*xerrok = 1;
|
||||
rv = execute(t->right, flags & XERROK, xerrok);
|
||||
else {
|
||||
flags |= XERROK;
|
||||
if (xerrok)
|
||||
*xerrok = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case TBANG:
|
||||
|
Reference in New Issue
Block a user