From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14828 invoked from network); 17 Aug 2009 21:50:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 17 Aug 2009 21:50:19 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 81154 invoked from network); 17 Aug 2009 21:50:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Aug 2009 21:50:13 -0000 Received: (qmail 24927 invoked by alias); 17 Aug 2009 21:50:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27219 Received: (qmail 24899 invoked from network); 17 Aug 2009 21:50:07 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Aug 2009 21:50:07 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5F3E28030818 for ; Mon, 17 Aug 2009 23:50:03 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090817215002.EQWG6611.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Mon, 17 Aug 2009 22:50:02 +0100 Received: from pws-pc ([82.6.98.90]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090817215002.HVSM13254.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Mon, 17 Aug 2009 22:50:02 +0100 Date: Mon, 17 Aug 2009 22:49:54 +0100 From: Peter Stephenson To: zsh-workers Subject: Re: Quoting problems with _zip (unzip) completer Message-ID: <20090817224954.0b55b854@pws-pc> In-Reply-To: <20090817215819.796e9416@pws-pc> References: <237967ef0908031315u72fa3661i17ff7f0107b85b9c@mail.gmail.com> <200908040850.n748oxlc011862@news01.csr.com> <20090817215819.796e9416@pws-pc> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=XmdzHtZaPY8A:10 a=NLZqzBF-AAAA:8 a=CcFzfB5atWeeWh4wgMEA:9 a=G8AXezDyCFKGYpRlxYU2PJD0mjQA:4 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9706/Mon Aug 17 23:11:57 2009 on bifrost X-Virus-Status: Clean On Mon, 17 Aug 2009 21:58:19 +0100 Peter Stephenson wrote: > So please watch out for any anomalous _arguments quoting behaviour. Found one in _rm... but it's not a knock-on effect of this patch, it's another thing that was already broken. rm stuff is supposed to exclude "stuff" from being completed again by using the -F option to _files by together with the line from _arguments: ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) _files -F ignored && ret=0 However, the code for "_files -F " was broken: instead of appending the contents of after the -F to the contents of the existing array, it appended the name . After fixing this, I'm gratified to find that in a directory containing files called "normal" and "foo[bar", it's possible to have both files ignored owing to the previous fix (with just this fix, and not the previous one, it only works for "normal"). (I'm not *quite* sure how this works, actually. The extra quoting shown in the code above protects pattern characters, since we're actually passing a pattern, not a file name, so 'foo\[bar' from line becomes 'foo\\\[bar'. Unquoting the pattern characters gives 'foo\[bar' back as a literal match. I don't understand why this matches the file... I'm going to pretend I didn't notice.) I'm a bit surprised nobody noticed this wasn't working. If anyone finds this has a negative rather an a positive effect on ignoring files in "rm" completion, please try to reproduce it starting from "zsh -f". Index: Completion/Unix/Type/_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_files,v retrieving revision 1.10 diff -u -r1.10 _files --- Completion/Unix/Type/_files 21 Aug 2008 15:53:00 -0000 1.10 +++ Completion/Unix/Type/_files 17 Aug 2009 21:42:03 -0000 @@ -1,7 +1,7 @@ #compdef -redirect-,-default-,-default- local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried -local type sdef +local type sdef ignvars ignvar zparseopts -a opts \ '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+: @@ -18,14 +18,18 @@ fi tmp=$opts[(I)-F] if (( tmp )); then - ign=( $=opts[tmp+1] ) - if [[ $ign = _comp_ignore ]]; then + ignvars=($=opts[tmp+1]) + if [[ $ignvars = _comp_ignore ]]; then ign=( $_comp_ignore ) else + ign=() + for ignvar in $ignvars; do + ign+=(${(P)ignvar}) + done opts[tmp+1]=_comp_ignore fi else - ign= + ign=() fi if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/