From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2164 invoked by alias); 30 Oct 2016 17:09:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39777 Received: (qmail 5941 invoked from network); 30 Oct 2016 17:09:58 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-5.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.69):SA:0(-0.0/5.0):. Processed in 0.494757 secs); 30 Oct 2016 17:09:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.69 as permitted sender) X-Originating-IP: [86.21.219.59] X-Spam: 0 X-Authority: v=2.1 cv=HZrpNXw8 c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=urbvL3vd24HIlkzxv6oA:9 a=CjuIK1q_8ugA:10 Date: Sun, 30 Oct 2016 17:09:49 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: [BUG] (z)-flag interrupts if $() in input Message-ID: <20161030170949.612551cf@ntlworld.com> In-Reply-To: <20161030152525.GA12137@fujitsu.shahaf.local2> References: <1477809189.1509250.771544241.795E8177@webmail.messagingengine.com> <20161030152525.GA12137@fujitsu.shahaf.local2> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 30 Oct 2016 15:25:25 +0000 Daniel Shahaf wrote: > Should the command > . > % echo foo $() bar > . > print "foo bar\n" or return a parse error? > That's obviously a bug. The fix is easy, although I don't know why the case of end of input in a normal input sequence, just above, needs to be different. pws diff --git a/Src/parse.c b/Src/parse.c index 24b8cd9..50a0d5f 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -594,7 +594,7 @@ par_event(int endtok) if (tok == ENDINPUT) return 0; if (tok == endtok) - return 0; + return 1; p = ecadd(0); diff --git a/Test/D08cmdsubst.ztst b/Test/D08cmdsubst.ztst index 89e7259..3625373 100644 --- a/Test/D08cmdsubst.ztst +++ b/Test/D08cmdsubst.ztst @@ -153,3 +153,17 @@ eval 'foo echo this just works, OK\?)' 0:backtracking within command string parsing with alias still pending >this just works, OK? + + ( + set errexit + show_nargs() { print $#; } + print a $() b + print c "$()" d + ) +0:Empty $() is a valid empty substitution. +>a b +>c d + + empty=$() && print "'$empty'" +0:Empty $() is a valid assignment +>''