From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5880 invoked from network); 17 Nov 2008 10:10:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Nov 2008 10:10:55 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75982 invoked from network); 17 Nov 2008 10:10:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Nov 2008 10:10:51 -0000 Received: (qmail 22267 invoked by alias); 17 Nov 2008 10:10:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26052 Received: (qmail 22257 invoked from network); 17 Nov 2008 10:10:45 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Nov 2008 10:10:45 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 638C780524C4 for ; Mon, 17 Nov 2008 11:10:40 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly22g.srv.mailcontrol.com (MailControl) with ESMTP id mAHAAbSS021315 for ; Mon, 17 Nov 2008 10:10:38 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Mon, 17 Nov 2008 10:10:37 +0000 Date: Mon, 17 Nov 2008 10:10:31 +0000 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: parse error in process substitution Message-ID: <20081117101031.17dcf2b7@news01> In-Reply-To: <081116135129.ZM5711@torch.brasslantern.com> References: <200811162118.mAGLIgK5003632@pws-pc.ntlworld.com> <081116135129.ZM5711@torch.brasslantern.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Nov 2008 10:10:37.0209 (UTC) FILETIME=[BC8AF090:01C9489C] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.71.0.132 X-Virus-Scanned: ClamAV 0.92.1/8642/Mon Nov 17 05:01:08 2008 on bifrost X-Virus-Status: Clean On Sun, 16 Nov 2008 13:51:27 -0800 Bart Schaefer wrote: > schaefer[504] echo (<(echo|cat)|>(echo|cat)) > zsh: bad pattern: (/proc/self/fd/11|/proc/self/fd/13) > schaefer[505] setopt nonomatch nocshnullglob > schaefer[506] echo ${:-(<(echo|cat)|>(echo|cat))} > (<(echo|cat)|>(echo|cat)) > schaefer[507] echo ${~:-(<(echo|cat)|>(echo|cat))} > zsh: bad pattern: (<(echo|cat)|/proc/self/fd/12) > zsh: command not found: echocat > > Something still seems a bit odd there. Where did "echocat" come from? That's from >(echo|cat) which is getting parsed in some strange way. It shouldn't be being substituted at all. I'll have to track that down. > Also there's this -- first, zsh-4.2.0: > > schaefer<501> echo $(<(echo cat)) > zsh: no such file or directory: (echo cat) > > Now 4.3.9-dev-0 latest CVS: > > schaefer[509] echo $(<(echo cat)) > zsh: permission denied: /proc/self/fd/10 > > I wonder if the $(< ....) form should also be special-cased? Possibly, although you could also argue that if the contents look like anything other than < followed by something that expands to a string it should do that. It depends what you mean by "look like". You need to quote metacharacters to be sure of getting a file name in general, of course. > } I've allowed <(...) and >(...) to be expanded when sub = 0, but not when > } sub = 1, which is what happened before except only if the expansions > } were complete arguments, so I need to find a better description. > } "When parsing a string" is close but perhaps doesn't quite express it. > > That also leaves unanswered the question of exactly what constitutes > "a string" ... is the shell grammar really completely documented enough > to make that discernible? Not really. Here it means something on the lines of "anything other than a positional argument to a command or to array assignment". > } > One last item ... perhaps you can explain what's going on here: > } > > } > schaefer[518] cat <<(echo foo)what? > } > foo > } > schaefer[519] > } > > } > I'm not sure exactly what I expected, but that wasn't it. > } > } I haven't changed any of the parsing for redirections: they are handled > } separately. So it looks like this is now inconsistent and needs fixing. > > It used to produce a parse error. I guess I was expecting that it > would now produce either a "no such file" or a "no match" error > because "/proc/self/fd/11what?" doesn't exist. The reason I suggested it should perhaps still be a parse error is mostly for the case of >>(...). This won't work either but might give a more confusing error message or use a different fd or something. The latter might happen with the input form, in fact. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070