sh: Fix break/continue/return in multiline eval.
Example: eval $'return\necho bad'
This commit is contained in:
parent
387dcafe06
commit
75e1716807
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272983
@ -168,6 +168,8 @@ evalstring(char *s, int flags)
|
||||
else
|
||||
evaltree(n, flags);
|
||||
any = 1;
|
||||
if (evalskip)
|
||||
break;
|
||||
}
|
||||
popstackmark(&smark);
|
||||
setstackmark(&smark);
|
||||
|
@ -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
|
||||
|
9
bin/sh/tests/builtins/eval7.0
Normal file
9
bin/sh/tests/builtins/eval7.0
Normal 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
|
7
bin/sh/tests/builtins/eval8.7
Normal file
7
bin/sh/tests/builtins/eval8.7
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() {
|
||||
eval "return 7
|
||||
echo bad2"
|
||||
}
|
||||
f
|
Loading…
Reference in New Issue
Block a user