zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Brandon Philips <brandon@ifup.org>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: [[ 0 =~ 1 || 1 = 0 ]] returns true
Date: Tue, 2 Nov 2010 21:41:39 +0100	[thread overview]
Message-ID: <AANLkTi=ZQFRE62Dqw27hRCvG0tdJ_rvzDcYtwv+CWBKj@mail.gmail.com> (raw)
In-Reply-To: <20101102163428.GQ672@jenkins.home.ifup.org>

On 2 November 2010 17:34, Brandon Philips <brandon@ifup.org> wrote:
> On 18:17 Sat 09 Oct 2010, Phil Pennock wrote:
>> The dropping is short-circuiting, the same as in all shell evaluation of
>> && and ||.  The shell stops once it knows enough to know the answer.  So
>> false to the left of && will stop, and true to the left of || will stop.
>>
>> % [[ 1 == 1 && 3 == 2 && 4 == 4 && sb == sb ]]
>> +zsh:12> [[ 1 == 1 && 3 == 2 ]]
>> % [[ 1 == 1 && 3 != 2 && 4 == 4 && sb == sb ]]
>> +zsh:13> [[ 1 == 1 && 3 != 2 && 4 == 4 && sb == sb ]]
>>
>> So the issue appears to just be what the OP wrote, that =~ is messing up
>> &&/|| by inserting a sense inversion.
>>
>> % [[ 1 =~ 0 || 1 == 1 ]]
>> +zsh:18> [[ 1 -regex-match 0 || ! 1 == 1 ]]
>> % [[ 1 -regex-match 0 || 1 == 1 ]]
>> +zsh:19> [[ 1 -regex-match 0 || 1 == 1 ]]
>>
>> So it's related to use of =~ rather than -regex-match.  It's independent
>> of whether or not zsh/pcre is loaded.  So this is probably a bug which I
>> introduced when I wrote the =~ syntax support.  Looking now.
>
> Did you find anything? Curious on what the state of this is.
>
> Let me know if I can help.

It was fixed in cvs not long after this. I think the fix-mail started
a new thread somewhere.

-- 
Mikael Magnusson


  reply	other threads:[~2010-11-02 20:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 17:29 Mikael Magnusson
2010-10-09 20:06 ` Michael Hwang
2010-10-09 22:17   ` Phil Pennock
2010-11-02 16:34     ` Brandon Philips
2010-11-02 20:41       ` Mikael Magnusson [this message]
2010-11-02 23:37       ` Phil Pennock

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='AANLkTi=ZQFRE62Dqw27hRCvG0tdJ_rvzDcYtwv+CWBKj@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=brandon@ifup.org \
    --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).