Date: Sat, 23 Apr 2011 22:28:56 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/bin/sh error.h eval.c main.c src/tools/regression/bin/sh/execution fork3.0 redir6.0 redir7.0 Message-ID: <201104232230.p3NMU7iE099324@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jilles 2011-04-23 22:28:56 UTC FreeBSD src repository Modified files: bin/sh error.h eval.c main.c Added files: tools/regression/bin/sh/execution fork3.0 redir6.0 redir7.0 Log: SVN rev 220978 on 2011-04-23 22:28:56Z by jilles sh: Allow EV_EXIT through function calls, make {...} <redir more consistent. If EV_EXIT causes an exit, use the exception mechanism to unwind redirections and local variables. This way, if the final command is a redirected command, an EXIT trap now executes without the redirections. Because of these changes, EV_EXIT can now be inherited by the body of a function, so do so. This means that a function no longer prevents a fork before an exec being skipped, such as in f() { head -1 /etc/passwd; }; echo $(f) Wrapping a single builtin in a function may still cause an otherwise unnecessary fork with command substitution, however. An exit command or -e failure still invokes the EXIT trap with the original redirections and local variables in place. Note: this depends on SHELLPROC being gone. A SHELLPROC depended on keeping the redirections and local variables and only cleaning up the state to restore them. Revision Changes Path 1.22 +1 -0 src/bin/sh/error.h 1.102 +13 -12 src/bin/sh/eval.c 1.45 +2 -1 src/bin/sh/main.c 1.1 +4 -0 src/tools/regression/bin/sh/execution/fork3.0 (new) 1.1 +21 -0 src/tools/regression/bin/sh/execution/redir6.0 (new) 1.1 +21 -0 src/tools/regression/bin/sh/execution/redir7.0 (new)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104232230.p3NMU7iE099324>