From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9354 invoked by alias); 5 Jun 2014 06:18:30 -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: 32712 Received: (qmail 24223 invoked from network); 5 Jun 2014 06:18:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=SgOI718bKO1mqN2IY77WV5hflRQybog2A9YfFTR3Bjo=; b=PzLkp0Fp9SFc1JYk2WcX1PmWz0szNa3NE4WatKfTto5eeVH0KeC2G0hHgY42eAfHYY 4WGQbpIxCAwvTCEk61puR4CtMcqx4vrnhv/WItz8bmzN5VYqTs81n5lykQF0p23o1Ye3 WjMw/SzMJR1CX+4iVkva1ucpv7ivaOX67XG2R8grJYX6pAVa59YSNtWqncuOu7+ne8ni +QbnSnjwNFhauB/+3WeTo2ndxSZ0EgKLfKQ8b5ju+fZE3YOGzfyaHx4Rzzp/BFACzBFD 14dkXYg3Bbb/Vv2MTH2sIBeNLqX/riPD/p5vVZtrnOzC6EoYUQwhBIXTKRSNFPPQw9gm Cz8w== MIME-Version: 1.0 X-Received: by 10.140.109.70 with SMTP id k64mr75997923qgf.92.1401949105213; Wed, 04 Jun 2014 23:18:25 -0700 (PDT) Date: Thu, 5 Jun 2014 02:18:25 -0400 Message-ID: Subject: Possible bug in OR evaluation in zsh 4.3.10 From: Hamilton Turner To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=001a1139c10668f58304fb10b6ce --001a1139c10668f58304fb10b6ce Content-Type: text/plain; charset=UTF-8 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) This looks a lot like a bug to me, however Josip M. pointed out that the following works as expected, even on 4.3.10: if [[ "foo" =~ "^\.+$" ]] || [[ "foo" =~ "^\s*$" ]]; then; echo "OR test"; > fi Perhaps this is the proper approach - if so it should likely be mentioned in docs on using OR. IIRC, 4.3.10 is the latest in the RH repo, so this could be a non-trivial issue if it's actually a bug. Hope this helps, Hamilton --001a1139c10668f58304fb10b6ce--