From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23598 invoked by alias); 14 May 2015 13:50:13 -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: 35124 Received: (qmail 27465 invoked from network); 14 May 2015 13:50:11 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Message-ID: <5554A810.9060800@inlv.org> Date: Thu, 14 May 2015 14:50:08 +0100 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: [BUG] 'case' pattern matching bug with bracket expressions References: <55549FB2.80705@inlv.org> In-Reply-To: <55549FB2.80705@inlv.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Martijn Dekker schreef op 14-05-15 om 14:14: > The same thing does NOT produce an error, but a false positive (!), if > an extra non-matching pattern with | is added: > > case abc in ( [] | *[!a-z]*) echo yes ;; ( * ) echo no ;; esac > > Expected output: no > Got output: yes I tested some more and found the bug is very specific, occurring only if the second bracket expression (after the |) both starts with the "!" negator *and* is followed (not necessarily preceded) by a '*' wildcard. Test cases: case abc in ( [] | nonmatching ) echo yes ;; ( * ) echo no ;; esac Expected output: no Got output: no case abc in ( [] | *[A-Z]* ) echo yes ;; ( * ) echo no ;; esac Expected output: no Got output: no case abc in ( [] | *[!a-z] ) echo yes ;; ( * ) echo no ;; esac Expected output: no Got output: no case abc in ( [] | [!a-z]* ) echo yes ;; ( * ) echo no ;; esac Expected output: no Got output: yes <-- !!!! Thanks, - Martijn