hush: fix handling of heredocs starting with empty lines
function old new delta parse_stream 2748 2759 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
ca2f831ead
commit
d73cdbf84c
2
shell/ash_test/ash-heredoc/heredoc_empty3.right
Normal file
2
shell/ash_test/ash-heredoc/heredoc_empty3.right
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
Ok
|
4
shell/ash_test/ash-heredoc/heredoc_empty3.tests
Executable file
4
shell/ash_test/ash-heredoc/heredoc_empty3.tests
Executable file
@ -0,0 +1,4 @@
|
||||
cat <<EOF
|
||||
|
||||
Ok
|
||||
EOF
|
@ -4226,6 +4226,14 @@ static char *fetch_till_str(o_string *as_string,
|
||||
int prev = 0; /* not \ */
|
||||
int ch;
|
||||
|
||||
/* Starting with "" is necessary for this case:
|
||||
* cat <<EOF
|
||||
*
|
||||
* xxx
|
||||
* EOF
|
||||
*/
|
||||
heredoc.data = xzalloc(1); /* start as "", not as NULL */
|
||||
|
||||
goto jump_in;
|
||||
|
||||
while (1) {
|
||||
|
2
shell/hush_test/hush-heredoc/heredoc_empty3.right
Normal file
2
shell/hush_test/hush-heredoc/heredoc_empty3.right
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
Ok
|
4
shell/hush_test/hush-heredoc/heredoc_empty3.tests
Executable file
4
shell/hush_test/hush-heredoc/heredoc_empty3.tests
Executable file
@ -0,0 +1,4 @@
|
||||
cat <<EOF
|
||||
|
||||
Ok
|
||||
EOF
|
Loading…
Reference in New Issue
Block a user