1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-05 23:11:11 +02:00

Fix combination of HERE document and |&.

A missing flag setting up the HERE document mean that the size
of the wordcode needed to append the 2>&1 was counted incorrectly,
so the resulting wordcode was garbled.

Add test.
This commit is contained in:
Peter Stephenson 2017-05-08 10:54:08 +01:00
parent aa8157b463
commit f25d01a97c
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2017-05-08 Peter Stephenson <p.stephenson@samsung.com>
* 41060: Src/parse.c, Test/A04redirect.ztst: combination
of HERE document and |& was broken by miscounting wordcode owing
to missing flag.
2017-05-04 Daniel Shahaf <d.s@daniel.shahaf.name>
* 41038: NEWS: Document recent, backwards-compatible precommand

View file

@ -2143,7 +2143,7 @@ par_redir(int *rp, char *idstring)
* the definition of WC_REDIR_WORDS. */
ecispace(r, ncodes);
*rp = r + ncodes;
ecbuf[r] = WCB_REDIR(type);
ecbuf[r] = WCB_REDIR(type | REDIR_FROM_HEREDOC_MASK);
ecbuf[r + 1] = fd1;
/*

View file

@ -586,3 +586,18 @@
>x
>bar
>y
fn-here-pipe() {
cat <<-HERE |& cat
FOO
HERE
}
fn-here-pipe
which fn-here-pipe
0:Combination of HERE-document and |&
>FOO
>fn-here-pipe () {
> cat <<HERE 2>&1 | cat
>FOO
>HERE
>}