From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17336 invoked by alias); 18 May 2015 08:49:15 -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: 35181 Received: (qmail 14137 invoked from network); 18 May 2015 08:49:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f794b6d000001495-f9-5559a787384a Date: Mon, 18 May 2015 09:49:08 +0100 From: Peter Stephenson To: Mikael Magnusson , zsh workers Subject: Re: Pattern matching: backslash escaping not active in pattern passed from variable Message-id: <20150518094908.7189d00f@pwslap01u.europe.root.pri> In-reply-to: References: <5559577C.1060906@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+NgFjrLLMWRmVeSWpSXmKPExsVy+t/xK7rtyyNDDdacYLM4N/U7o8XB5odM DkweO2fdZfdYdfADUwBTFJdNSmpOZllqkb5dAlfG9vdH2Asu8VRcnf2fpYFxKlcXIweHhICJ xIUDfF2MnECmmMSFe+vZuhi5OIQEljJKXD64kQnCaWCSuHRyCjuEs41R4tS+VkaQFhYBVYkt DZOYQWw2AUOJqZtmg8VFBLwlehetYQKxhQXiJD4vOs0KYvMK2Et8ubYbrJ5TIFii/fZ5sLiQ QJ7ErL+tYDa/gL7E1b+fmCBOspeYeeUMI0SvoMSPyfdYQGxmAS2JzduaWCFseYnNa94yQ8xR l7hxdzf7BEahWUhaZiFpmYWkZQEj8ypG0dTS5ILipPRcI73ixNzi0rx0veT83E2MkED+uoNx 6TGrQ4wCHIxKPLwr/CJDhVgTy4orcw8xSnAwK4nw/moGCvGmJFZWpRblxxeV5qQWH2KU5mBR Eueduet9iJBAemJJanZqakFqEUyWiYNTqoFR6p2Pm+Sj4g1SfnN33Tx2YM6prhMzt/x3OnP7 ibFmuV3KBSPeLbPWNTlOvpK+V0Gi+q9hVdus9qINh3J5HuyuveO13aZ9HscvQxPHldvluzlO nT7Laf3B6seaXY52Xarz62ZPWdk/4aPRLoXTdzmKl5TnLWudFHpoKvOH8lc57ssn7Dd9N+P9 LSWW4oxEQy3mouJEAI1MAeRgAgAA On Mon, 18 May 2015 10:33:31 +0200 Mikael Magnusson wrote: > On Mon, May 18, 2015 at 5:07 AM, Martijn Dekker wrote: > > Peter Stephenson's patch for case pattern matching applied cleanly > > against the latest git code and is working perfectly. Many thanks. > > > > There is another snag I've found in pattern matching, which seems to > > have survived this patch: backslash escaping does not seem match the > > standard if a glob pattern is passed from a variable or parameter. The > > standard says: > [...] > > In any case, I would expect backslash escaping to work the same way > > whether the glob pattern is passed from a variable or parameter or not. > > see the GLOB_SUBST option. GLOB_SUBST roughly covers the last remark (and GLOB_SUBST is on in POSIX mode), but not the thing about backslashes --- zsh only removes the backslashes around pattern characters, not other characters, if it knows the context is just quoting patterns, which is true of characters made "live" by the effect of GLOB_SUBST. That's why the new (b) parameter expansion flag turned up. I suppose that ought to be fixable in compatibility mode --- we certainly don't want to mess around with quoting in native mode. (I said "roughly" above because there's a big can of worms here about when quoting happens --- normal backslash quoting happens on input to the lexer, backslash quoting of patterns much later and in this case possibly in addition --- but the intention is GLOB_SUBST should at least make zsh look like other shells, messy though that is.) pws