zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Hamilton Turner <hamiltont@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Possible bug in OR evaluation in zsh 4.3.10
Date: Thu, 5 Jun 2014 12:42:09 +0200	[thread overview]
Message-ID: <CAHYJk3SCf2BHUeY+wwhc+4ouP4Dzuh8R2C2oPtO-bKj8cKchyQ@mail.gmail.com> (raw)
In-Reply-To: <CAFow3A-9czw1OU+P1_go_xswFW92DKizv2GnS-OzAhY6FQ-CLQ@mail.gmail.com>

On 5 June 2014 08:18, Hamilton Turner <hamiltont@gmail.com> wrote:
> I'm experiencing this unexpected behavior:
>
> $ if [[ "foo" =~ "^\s*$" ]]; then; echo "Test"; fi
>> $ if [[ "foo" =~ "^\.+$" ]]; then; echo "Test"; fi
>> $ if [[ "foo" =~ "^\.+$" || "foo" =~ "^\s*$" ]]; then; echo "OR test"; fi
>> OR test
>
>
> Now my shell scripting is definitely not superb, but this seems to be
> incorrect - I would expect that
> none of the if conditions trigger an echo. Assuming that my expectation is
> correct, here's what I
> know:
>
> na: zsh 4.2.1 on Solaris 10 (no =~ operator)
> fail: zsh 4.3.10 on CentOS 6
> fail: zsh 4.3.10 on RH 6.3 and 6.5
> ok; 4.3.17 on Solaris 11
> ok: 4.3.17 on Ubuntu 12.04
> ok: zsh 5.0.2 on Ubuntu 14.04
> ok: zsh 5.0.2 on OS X
> ok: zsh 5.0.2 on CentOS 6
>
> (Thanks a ton to boyd from #zsh for help on different systems)

Yes, this is a bug that has been fixed. IIRC, -regex-match always
works correctly, only the =~ operator didn't, if you do need scripts
to run on broken zsh versions.

-- 
Mikael Magnusson


  reply	other threads:[~2014-06-05 10:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05  6:18 Hamilton Turner
2014-06-05 10:42 ` Mikael Magnusson [this message]
2014-06-06  5:05   ` Hamilton Turner

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=CAHYJk3SCf2BHUeY+wwhc+4ouP4Dzuh8R2C2oPtO-bKj8cKchyQ@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=hamiltont@gmail.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).