ash: fix error during recursive processing of here document
Save the value of the checkkwd flag to prevent it being clobbered during recursion. Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu. function old new delta readtoken 190 203 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7b14ede049
commit
713f07d906
@ -11899,6 +11899,7 @@ static int
|
|||||||
readtoken(void)
|
readtoken(void)
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
|
int kwd = checkkwd;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
smallint alreadyseen = tokpushback;
|
smallint alreadyseen = tokpushback;
|
||||||
#endif
|
#endif
|
||||||
@ -11912,7 +11913,7 @@ readtoken(void)
|
|||||||
/*
|
/*
|
||||||
* eat newlines
|
* eat newlines
|
||||||
*/
|
*/
|
||||||
if (checkkwd & CHKNL) {
|
if (kwd & CHKNL) {
|
||||||
while (t == TNL) {
|
while (t == TNL) {
|
||||||
parseheredoc();
|
parseheredoc();
|
||||||
t = xxreadtoken();
|
t = xxreadtoken();
|
||||||
@ -11926,7 +11927,7 @@ readtoken(void)
|
|||||||
/*
|
/*
|
||||||
* check for keywords
|
* check for keywords
|
||||||
*/
|
*/
|
||||||
if (checkkwd & CHKKWD) {
|
if (kwd & CHKKWD) {
|
||||||
const char *const *pp;
|
const char *const *pp;
|
||||||
|
|
||||||
pp = findkwd(wordtext);
|
pp = findkwd(wordtext);
|
||||||
|
1
shell/ash_test/ash-heredoc/heredoc3.right
Normal file
1
shell/ash_test/ash-heredoc/heredoc3.right
Normal file
@ -0,0 +1 @@
|
|||||||
|
hello
|
9
shell/ash_test/ash-heredoc/heredoc3.tests
Executable file
9
shell/ash_test/ash-heredoc/heredoc3.tests
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
echo hello >greeting
|
||||||
|
cat <<EOF &&
|
||||||
|
$(cat greeting)
|
||||||
|
EOF
|
||||||
|
{
|
||||||
|
echo $?
|
||||||
|
cat greeting
|
||||||
|
} >/dev/null
|
||||||
|
rm greeting
|
Loading…
Reference in New Issue
Block a user