ash: fix ifs cleanup on error paths
Patch by Alex Gorinson <algore3698@gmail.com> function old new delta evalvar 477 495 +18 varvalue 603 618 +15 subevalvar 1557 1572 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 48/0) Total: 48 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
5479c435fd
commit
1c54552842
@ -7028,6 +7028,7 @@ varunset(const char *end, const char *var, const char *umsg, int varflags)
|
|||||||
msg = umsg;
|
msg = umsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ifsfree();
|
||||||
ash_msg_and_raise_error("%.*s: %s%s", (int)(end - var - 1), var, msg, tail);
|
ash_msg_and_raise_error("%.*s: %s%s", (int)(end - var - 1), var, msg, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7453,6 +7454,7 @@ varvalue(char *name, int varflags, int flags, int quoted)
|
|||||||
if (discard)
|
if (discard)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
ifsfree();
|
||||||
raise_error_syntax("bad substitution");
|
raise_error_syntax("bad substitution");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
shell/ash_test/ash-heredoc/heredoc_and_cmd.right
Normal file
2
shell/ash_test/ash-heredoc/heredoc_and_cmd.right
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
./heredoc_and_cmd.tests: line 4: D: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
Y
|
8
shell/ash_test/ash-heredoc/heredoc_and_cmd.tests
Executable file
8
shell/ash_test/ash-heredoc/heredoc_and_cmd.tests
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
# The bug was only happening with <<REDIR;CMD form below:
|
||||||
|
M='AAAAAAAAAAAAAAAAA'
|
||||||
|
fff(){
|
||||||
|
date <<000; echo Y
|
||||||
|
${D?$M$M$M$M$M$M}
|
||||||
|
000
|
||||||
|
}
|
||||||
|
fff
|
2
shell/hush_test/hush-heredoc/heredoc_and_cmd.right
Normal file
2
shell/hush_test/hush-heredoc/heredoc_and_cmd.right
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
hush: D: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
Y
|
8
shell/hush_test/hush-heredoc/heredoc_and_cmd.tests
Executable file
8
shell/hush_test/hush-heredoc/heredoc_and_cmd.tests
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
# The bug was only happening with <<REDIR;CMD form below:
|
||||||
|
M='AAAAAAAAAAAAAAAAA'
|
||||||
|
fff(){
|
||||||
|
date <<000; echo Y
|
||||||
|
${D?$M$M$M$M$M$M}
|
||||||
|
000
|
||||||
|
}
|
||||||
|
fff
|
Loading…
Reference in New Issue
Block a user