Date: Sat, 6 Mar 2010 17:09:22 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r204801 - in head: bin/sh tools/regression/bin/sh/builtins Message-ID: <201003061709.o26H9M7T084567@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003061709.o26H9M7T084567>
