From 0d0e497c693939633fda6cfa0c3269258b8e97ec Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@users.sourceforge.net>
Date: Mon, 17 Nov 2008 16:56:41 +0000
Subject: [PATCH] 26056 "< <(...)more_stuff" etc. are errors

---
 ChangeLog       | 3 +++
 Doc/Zsh/expn.yo | 2 ++
 Src/exec.c      | 7 ++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e3e902d1c..fede2f8e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-11-17  Peter Stephenson  <pws@csr.com>
 
+	* 26056: Doc/Zsh/expn.yo, Src/exec.c:  < <(...)more_stuff is
+	an error and similarly for > >(...)yet_more_stuff.
+
 	* 26055: README, Doc/Zsh/expn.yo, Src/subst.c: ensure process
 	substitution is handled completely before parameter and
 	command substitution.
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 2e5af790c..ec92a34b9 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -362,6 +362,8 @@ or followed by other strings except that, to prevent clashes with
 commonly occurring strings and patterns, the last
 form must occur at the start of a command argument, and the forms
 are only expanded when first parsing command or assignment arguments.
+Process substitutions may be used following redirection operators; in this
+case, the substitution must appear with no trailing string.
 
 In the case of the tt(<) or tt(>) forms, the shell runs the commands in
 var(list) asynchronously.  If the system supports the tt(/dev/fd)
diff --git a/Src/exec.c b/Src/exec.c
index a398211d3..5aec655a2 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3773,9 +3773,14 @@ getpipe(char *cmd, int nullexec)
     int pipes[2], out = *cmd == Inang;
     pid_t pid;
     struct timeval bgtime;
+    char *ends;
 
-    if (!(prog = parsecmd(cmd, NULL)))
+    if (!(prog = parsecmd(cmd, &ends)))
 	return -1;
+    if (*ends) {
+	zerr("invalid syntax for process substitution in redirection");
+	return -1;
+    }
     mpipe(pipes);
     if ((pid = zfork(&bgtime))) {
 	zclose(pipes[out]);