From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20578 invoked from network); 9 Apr 2008 08:49:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 9 Apr 2008 08:49:31 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 35991 invoked from network); 9 Apr 2008 08:49:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Apr 2008 08:49:25 -0000 Received: (qmail 2307 invoked by alias); 9 Apr 2008 08:49:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24802 Received: (qmail 2290 invoked from network); 9 Apr 2008 08:49:21 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 9 Apr 2008 08:49:21 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5BA8D802A5F0 for ; Wed, 9 Apr 2008 10:49:14 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly20d.srv.mailcontrol.com (MailControl) with ESMTP id m398nAsx018685 for ; Wed, 9 Apr 2008 09:49:12 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Apr 2008 09:49:10 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id m398nA1N012027 for ; Wed, 9 Apr 2008 09:49:10 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id m398n4W2012023 for ; Wed, 9 Apr 2008 09:49:10 +0100 Message-Id: <200804090849.m398n4W2012023@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers Subject: Re: _subscript quotes too much In-reply-to: <237967ef0804081711t6b4a9d88qa8b5367ba1ba8fb0@mail.gmail.com> References: <237967ef0804081708h72b87699n6235099044238a13@mail.gmail.com> <237967ef0804081711t6b4a9d88qa8b5367ba1ba8fb0@mail.gmail.com> Comments: In-reply-to "Mikael Magnusson" message dated "Wed, 09 Apr 2008 02:11:57 +0200." Date: Wed, 09 Apr 2008 09:49:04 +0100 From: Peter Stephenson X-OriginalArrivalTime: 09 Apr 2008 08:49:10.0380 (UTC) FILETIME=[940F82C0:01C89A1E] X-Scanned-By: MailControl A-08-00-04 (www.mailcontrol.com) on 10.68.0.130 X-Virus-Scanned: ClamAV 0.91.2/6677/Wed Apr 9 10:24:38 2008 on bifrost X-Virus-Status: Clean "Mikael Magnusson" wrote: > On 09/04/2008, Mikael Magnusson wrote: > > % zsh -f > > % autoload -U compinit; compinit > > % typeset -A foo > > % foo[bar]=baz > > % foo[*.txt]=blue > > % echo $foo[ > > % echo $foo[\*.txt] > > > > % echo $foo[*.txt] > > blue > > > > I had a look at _subscript but it didn't mean much to me. I thought > > maybe there was a (q) too many but there are none at all. As there are no special rules for subscripts once it gets to the adding of completions (obviously the list is generated specially), they use the normal rules that would apply for quoting command line arguments, which quote globbing characters. I've a vague feeling that not handling \* the same as * is a bug, but quoting in subscripts is a horrible can of worms. I would expect backslash-quoting, at least, to be uniformly applied. > Also a bit weird, > % foo[{]=bar > zsh: no matches found: foo[{]=bar > % foo[{a,b}]=bar I would certainly expect you to need quoting here, and foo[\{]=bar does work. The fact you get away with it the second time is luck. Note that only single argument substitution happens in subscripts. > % echo $foo[\{a,b\}] #produced by tab complete > bar > % echo $foo[\{a,b}] > bar > % echo $foo[{a,b}] > bar Same comment, essentially, reinforcing my notion that not handling $foo[\*.txt] is a bug. > % echo $foo['{a,b}'] This is a side-effect of the fact that we're only doing single argument substitution and not full argument parsing. The quotes don't get parsed as quotes. > I guess I'm wandering into the land of very subtle rules here... :) Oh, yes. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070