zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911)
Date: Fri, 18 Oct 2013 20:29:08 +0100	[thread overview]
Message-ID: <20131018202908.31e561b4@pws-pc.ntlworld.com> (raw)
In-Reply-To: <131018084831.ZM8783@torch.brasslantern.com>

On Fri, 18 Oct 2013 08:48:31 -0700
Bart Schaefer <schaefer@brasslantern.com> 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 <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      parent reply	other threads:[~2013-10-18 20:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 14:02 Filip Krska
2013-10-18 15:33 ` Peter Stephenson
2013-10-18 19:12   ` Peter Stephenson
2013-10-18 15:48 ` Bart Schaefer
2013-10-18 15:56   ` Peter Stephenson
2013-10-18 19:20     ` Bart Schaefer
2013-10-18 22:43       ` Peter Stephenson
2013-10-19 21:19         ` Bart Schaefer
2013-10-19 21:46           ` Bart Schaefer
2013-10-19 21:56           ` Peter Stephenson
2013-11-20 14:08             ` Filip Krska
2013-10-18 19:29   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131018202908.31e561b4@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).