From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26199 invoked by alias); 18 Oct 2013 20:31:51 -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: 31846 Received: (qmail 19499 invoked from network); 18 Oct 2013 20:31:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=pn6Au8wLdk+X7x//EJLvvhq/1JTTJS7c33I8XGWApjM=; b=CMwtzEZRAcpDXwGV9OO/2jdaTdyr2mZLZlVpRx54wrC3IQ74nBB1HaQrbLsZPg7csT uxMR3U6qZmF/k5H/QgiowNT/JSsN7KMNmgqjlcDs3WhV9AcYehKKQnbEKhlx+1UTj0Ml /QOtN9PLc1qmGE0VA7WB324Zl5VYN05dvCJurTb9K788Kq/8zh6TJ1+j5++MYgNkt97B 5s8JV/16HEgIvRPh6vPQDScJ06NLSUlEWFL3KVHD9nRctKMSD/obRwk9Be2O/VVdNNBo FRs7Cl7OzKhINOqdWUE8MegGB3e+AabdAGl9eDUpuB8DR0jopCJxc5yl1pxOyHa5viDj QvvQ== X-Gm-Message-State: ALoCoQmYQFJSwXtcSc3bZqgz45um4B1HeGZZiFBSLMgJO7gDZTv9RFdIhgNKy+AL2RP8LLonAZJh X-Received: by 10.15.100.198 with SMTP id bn46mr6551503eeb.11.1382124550816; Fri, 18 Oct 2013 12:29:10 -0700 (PDT) X-ProxyUser-IP: 86.6.157.246 Date: Fri, 18 Oct 2013 20:29:08 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911) Message-ID: <20131018202908.31e561b4@pws-pc.ntlworld.com> In-Reply-To: <131018084831.ZM8783@torch.brasslantern.com> References: <52613F82.1000009@redhat.com> <131018084831.ZM8783@torch.brasslantern.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 18 Oct 2013 08:48:31 -0700 Bart Schaefer wrote: > On Oct 18, 4:02pm, Filip Krska wrote: > } > } zsh syntax check fails on simple script, which is syntactically OK, but zsh -n returns 1 > > Hmm, it's not actually the syntax check which is failing. > > If you run the test as > > zsh -vxn /tmp/test.zsh > > it becomes clear that zsh is actually executing some of the commands, > and then returning the exit status of those commands rather than of > the syntax check itself. > > Which is strange, particularly given that adding the ":" command in > the if-block causes it to revert to executing nothing. (Changing > the $(...) construct is a red herring, it's just changing the exit > status of the line zsh is wrongly executing in the first place.) Looked at from this point of view, the fix is probably not to execute code optimised as "simple". diff --git a/Src/exec.c b/Src/exec.c index 8efbbd4..e95cad3 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1087,6 +1087,9 @@ execsimple(Estate state) if (errflag) return (lastval = 1); + if (!isset(EXECOPT)) + return lastval = 0; + /* In evaluated traps, don't modify the line number. */ if (!IN_EVAL_TRAP() && !ineval && code) lineno = code - 1; -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/