sh: Fix break/continue/return in multiline eval.

Example:
  eval $'return\necho bad'
This commit is contained in:
Jilles Tjoelker 2014-10-12 13:12:06 +00:00
parent 387dcafe06
commit 75e1716807
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272983
4 changed files with 20 additions and 0 deletions

View File

@ -168,6 +168,8 @@ evalstring(char *s, int flags)
else
evaltree(n, flags);
any = 1;
if (evalskip)
break;
}
popstackmark(&smark);
setstackmark(&smark);

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,7 @@
# $FreeBSD$
f() {
eval "return 7
echo bad2"
}
f