Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh parser segmentation fault on taddstr



On Sun, 7 May 2017 21:36:31 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> % fn() { cat <<y |& cat
> FOO
> y
> }
> % which fn
>  text.c:995: unknown word code in gettext2()
> fn () {
> 	time <<y | cat
> }

This fixes the missing flag that was causing that problem.

pws

diff --git a/Src/parse.c b/Src/parse.c
index 6fe283d..83e87af 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -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;
 
 	/*
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index d7fe22f..a5de552 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -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
+>}



Messages sorted by: Reverse Date, Date, Thread, Author