From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10260 invoked by alias); 14 May 2015 16:06:43 -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: 35130 Received: (qmail 9444 invoked from network); 14 May 2015 16:06:41 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-f794b6d000001495-e4-5554c5b43e7b Date: Thu, 14 May 2015 16:55:57 +0100 From: Peter Stephenson To: Martijn Dekker , zsh-workers@zsh.org Subject: Re: 'case' pattern matching bug with bracket expressions Message-id: <20150514165557.59f6bdc9@pwslap01u.europe.root.pri> In-reply-to: <5554C3A5.4030205@inlv.org> References: <55549FB2.80705@inlv.org> <20150514154238.0e547ff0@pwslap01u.europe.root.pri> <5554C3A5.4030205@inlv.org> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t/xa7pbjoaEGqz8Z2pxqivF4mDzQyYH Jo+/aycxeaw6+IEpgCmKyyYlNSezLLVI3y6BK2Pvu0VMBV08FdOmnGVsYGzj7GLk4JAQMJH4 /Me3i5ETyBSTuHBvPVsXIxeHkMBSRom101YxQjgNTBJLDtxhhXC2MUr83zKbFaSFRUBV4un2 6ywgNpuAocTUTbMZQWwRASuJTzP/gNnCAo4Sv/o7wep5BewlHjTOYwKxOQU0JP5f/grWKyRQ LvH80SuwGn4BfYmrfz8xQZxkLzHzyhlGiF5BiR+T74HVMwtoSWze1sQKYctLbF7zlhlijrrE jbu72ScwCs1C0jILScssJC0LGJlXMYqmliYXFCel5xrpFSfmFpfmpesl5+duYoSE8dcdjEuP WR1iFOBgVOLh5TAMDhViTSwrrsw9xCjBwawkwlu3KSRUiDclsbIqtSg/vqg0J7X4EKM0B4uS OO/MXe9DhATSE0tSs1NTC1KLYLJMHJxSDYwnPW30dF782XJRNcbYYdb/5OPxC7Iq90yP116m 9UitI+Jvf5Hit8TO51+XmCuUL2tLX3y8l5HLpFmbY+o1J5OdT96t+ucZG9PGPjv96OYoubd1 TllZErn3519mL3M/oWvKxZf0RXvq324N0ZUXHrsksKhIzUm56qH7d5trwH2ZwDuFh24HP1Ni Kc5INNRiLipOBAAC3LfcXwIAAA== On Thu, 14 May 2015 16:47:49 +0100 Martijn Dekker wrote: > Peter Stephenson schreef op 14-05-15 om 15:42: > > This is the pattern: > > '[' introducing bracketed expression > > '] | *[!a-z' characters inside > > ']' end of bracketed expression > > '*' wildcard. > > Ah ha, that makes sense of the whole thing. Thank you. > > > I'm not really sure we *can* resolve this unambiguously the way you > > want. Is there something that forbids us from interpreting the pattern > > that way? > > Apparently not, as far as I can tell. It occurs to me that other shells will treat whitespace as ending a pattern for syntactic reasons, even if logically it can't: [[ ' ' = [ ] ]] works in zsh, but is a parse error in bash. Usually zsh's behaviour is the more useful, because if the expression is meaningful at all there has to be a closing brace(*). But it's not impossible it does break some rule about whitespace as separators --- and you've come up with the first example I've ever seen of where it's significant even if the alternative isn't an error. So it might be more useful to change this in POSIX compatibility mode, in which what zsh users expect has never been a significant factor. pws (*) Relegated to a footnote because this is more of a rant than a useful comment: furthermore, the whole []] thing is designed so that you *don't* need to quote characters in the [...]. So do you, or don't you? Bleugh.