svn commit: r204801 - in head: bin/sh
tools/regression/bin/sh/builtins
Jilles Tjoelker
jilles at FreeBSD.org
Sat Mar 6 17:09:23 UTC 2010
Author: jilles
Date: Sat Mar 6 17:09:22 2010
New Revision: 204801
URL: http://svn.freebsd.org/changeset/base/204801
Log:
sh: Make sure to popredir() even if a special builtin caused an error.
Added:
head/tools/regression/bin/sh/builtins/command9.0 (contents, props changed)
Modified:
head/bin/sh/eval.c
Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c Sat Mar 6 16:57:53 2010 (r204800)
+++ head/bin/sh/eval.c Sat Mar 6 17:09:22 2010 (r204801)
@@ -914,6 +914,9 @@ cmddone:
backcmd->nleft = memout.nextc - memout.buf;
memout.buf = NULL;
}
+ if (cmdentry.u.index != EXECCMD &&
+ (e == -1 || e == EXERROR || e == EXEXEC))
+ popredir();
if (e != -1) {
if ((e != EXERROR && e != EXEXEC)
|| cmdentry.special)
@@ -922,8 +925,6 @@ cmddone:
if (flags != EV_BACKCMD)
FORCEINTON;
}
- if (cmdentry.u.index != EXECCMD)
- popredir();
} else {
#ifdef DEBUG
trputs("normal command: "); trargs(argv);
Added: head/tools/regression/bin/sh/builtins/command9.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/command9.0 Sat Mar 6 17:09:22 2010 (r204801)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+ if ! eval "[ $* ]"; then
+ echo "Failed: $*"
+ : $((failures += 1))
+ fi
+}
+
+check '"$({ command eval shift x 2>/dev/null; } >/dev/null; echo hi)" = hi'
+
+exit $((failures > 0))
More information about the svn-src-all
mailing list