diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/exec.c | 12 | ||||
-rw-r--r-- | Test/A04redirect.ztst | 24 |
3 files changed, 34 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index 0bf5502b6..c2d9b1c7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-04-29 Barton E. Schaefer <schaefer@zsh.org> + + * Ricardo Giorni: 47201: fix 42355 for multiple backslashes + 2018-04-26 Peter Stephenson <p.stephenson@samsung.com> * c.f. 42726: Test/W02jobs.ztst: Back off fg and bg tests as they diff --git a/Src/exec.c b/Src/exec.c index ee55aac8c..64cf5ae46 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4435,16 +4435,16 @@ gethere(char **strp, int typ) bptr = buf + bsiz; bsiz *= 2; } - if (lexstop) + if (lexstop || c == '\n') break; - if (c == '\n') { - if (!qt && bptr > t && *(bptr - 1) == '\\') { - /* line continuation */ + if (!qt && c == '\\') { + *bptr++ = c; + c = hgetc(); + if (c == '\n') { bptr--; c = hgetc(); continue; - } else - break; + } } *bptr++ = c; c = hgetc(); diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index b5b65cf5d..1e17dddd4 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -176,6 +176,30 @@ >tab\stripping >Last line + heretest() { + print First line + cat <<-HERE + $foo\\ + $foo + some\\ \ + stuff + to\ + test \\ + more backslash craziness\\\\\\\\\ + wild + HERE + print Last line + } + heretest +0:No line continuation in here-document on escaped backslash +>First line +>bar\ +>bar +>some\ stuff +>to test \ +>more backslash craziness\\\\ wild +>Last line + # # exec tests: perform these in subshells so if they fail the # shell won't exit. |