From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93 invoked by alias); 2 Nov 2010 20:44:25 -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: 28386 Received: (qmail 6561 invoked from network); 2 Nov 2010 20:44:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06 autolearn=no version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at ifup.org does not designate permitted sender hosts) Date: Tue, 2 Nov 2010 09:34:28 -0700 From: Brandon Philips To: Michael Hwang , Mikael Magnusson , zsh workers Subject: Re: [[ 0 =~ 1 || 1 = 0 ]] returns true Message-ID: <20101102163428.GQ672@jenkins.home.ifup.org> References: <20101009221700.GA60765@redoubt.spodhuis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101009221700.GA60765@redoubt.spodhuis.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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. Thanks, Brandon