svn commit: r272983 - in head/bin/sh: . tests/builtins
Jilles Tjoelker
jilles at FreeBSD.org
Sun Oct 12 13:12:07 UTC 2014
Author: jilles
Date: Sun Oct 12 13:12:06 2014
New Revision: 272983
URL: https://svnweb.freebsd.org/changeset/base/272983
Log:
sh: Fix break/continue/return in multiline eval.
Example:
eval $'return\necho bad'
Added:
head/bin/sh/tests/builtins/eval7.0 (contents, props changed)
head/bin/sh/tests/builtins/eval8.7 (contents, props changed)
Modified:
head/bin/sh/eval.c
head/bin/sh/tests/builtins/Makefile
Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c Sun Oct 12 11:22:25 2014 (r272982)
+++ head/bin/sh/eval.c Sun Oct 12 13:12:06 2014 (r272983)
@@ -168,6 +168,8 @@ evalstring(char *s, int flags)
else
evaltree(n, flags);
any = 1;
+ if (evalskip)
+ break;
}
popstackmark(&smark);
setstackmark(&smark);
Modified: head/bin/sh/tests/builtins/Makefile
==============================================================================
--- head/bin/sh/tests/builtins/Makefile Sun Oct 12 11:22:25 2014 (r272982)
+++ head/bin/sh/tests/builtins/Makefile Sun Oct 12 13:12:06 2014 (r272983)
@@ -72,6 +72,8 @@ FILES+= eval3.0
FILES+= eval4.0
FILES+= eval5.0
FILES+= eval6.0
+FILES+= eval7.0
+FILES+= eval8.7
FILES+= exec1.0
FILES+= exec2.0
FILES+= exit1.0
Added: head/bin/sh/tests/builtins/eval7.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/eval7.0 Sun Oct 12 13:12:06 2014 (r272983)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Assumes that break can break out of a loop outside eval.
+
+while :; do
+ eval "break
+echo bad1"
+ echo bad2
+ exit 3
+done
Added: head/bin/sh/tests/builtins/eval8.7
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/eval8.7 Sun Oct 12 13:12:06 2014 (r272983)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+f() {
+ eval "return 7
+echo bad2"
+}
+f
More information about the svn-src-all
mailing list