zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911)
Date: Fri, 18 Oct 2013 12:20:00 -0700	[thread overview]
Message-ID: <131018122000.ZM9018@torch.brasslantern.com> (raw)
In-Reply-To: <20131018165614.48f399b7@pwslap01u.europe.root.pri>

On Oct 18,  4:56pm, Peter Stephenson wrote:
} Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911)
}
} On Fri, 18 Oct 2013 08:48:31 -0700
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} > 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.
} 
} It's certainly forking, and I think it's peforming the assignments, and
} it seems to perform the test.  The problem here is we don't actually
} have a syntax checking mode, we just have a mode that tries to execute
} as little as possible.  As little as possible isn't a very clear target.

Well, yeah, but it's really strange that in some cases it executes NOTHING,
and in other very similar cases it executes the tests and assignments, and
it's really not obvious why there's a difference.

Compare these three commands:

Src/zsh -fvxnc 'if [[ $# -gt 0 ]]; then :; X=$1; fi'

Src/zsh -fvxnc 'if [[ $# -gt 0 ]]; then X=$1; fi'

Src/zsh -fvxnc 'if [ $# -gt 0 ]; then X=$1; fi'

Why does the inclusion of the ":" in the first case cause the execution of
the test to be skipped?  Why does the use of [[ ]] in place of [  ] cause
the test to be executed?

Additionally:
Why doesn't -v result in any output when used with -c ?  If you put any
of the above one-liners in a file and executed it as a script, it gets
printed as verbose output.


  reply	other threads:[~2013-10-18 19:20 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 [this message]
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

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=131018122000.ZM9018@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).