From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10805 invoked from network); 17 Aug 2009 21:07:11 -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:07:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 66877 invoked from network); 17 Aug 2009 20:59:03 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Aug 2009 20:59:03 -0000 Received: (qmail 14772 invoked by alias); 17 Aug 2009 20:58:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27218 Received: (qmail 14752 invoked from network); 17 Aug 2009 20:58:55 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Aug 2009 20:58:55 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id 923838030819 for ; Mon, 17 Aug 2009 22:58:35 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090817205832.NRS5579.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Mon, 17 Aug 2009 21:58:32 +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 <20090817205831.HBVV13254.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Mon, 17 Aug 2009 21:58:31 +0100 Date: Mon, 17 Aug 2009 21:58:19 +0100 From: Peter Stephenson To: zsh-workers Subject: Re: Quoting problems with _zip (unzip) completer Message-ID: <20090817215819.796e9416@pws-pc> In-Reply-To: <200908040850.n748oxlc011862@news01.csr.com> References: <237967ef0908031315u72fa3661i17ff7f0107b85b9c@mail.gmail.com> <200908040850.n748oxlc011862@news01.csr.com> 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=4UtWO5riAAAA:8 a=NLZqzBF-AAAA:8 a=w8HQec_XNBq9uyjml9gA:9 a=9gU2HcUpEmyWOn4DeE4A:7 a=OCvl66XYLAYdgeQEObb7HfxFoOoA:4 a=Shd8Sdw-9eQA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9705/Mon Aug 17 19:03:09 2009 on bifrost X-Virus-Status: Clean On Tue, 04 Aug 2009 09:50:59 +0100 Peter Stephenson wrote: > Mikael Magnusson wrote: > > % unzip test\[.zip > > _zip:117: bad pattern: test[.zip(|.zip|.ZIP) > > _zip:117: bad pattern: test[.zip(|.zip|.ZIP) > > _zip:117: bad pattern: test[.zip(|.zip|.ZIP) > > ... the value of "line" [in _zip] is a bit inconsistent. Sure > enough if I use ~/tmp/zip/tmp\[.zip $line[1] comes back (using print -r) as > > ~/tmp/zip/test[.zip > > which is wrong---either the ~ needs to be expanded, or the [ needs to be > quoted. So this needs tracking internally, unfortunately. If it hits > the internal completion quoting system we're probably stuck---I spent > weeks looking at that a couple of years ago and got virtually nowhere. > However, it may not be that bad in this case. It's inside comparguments, but luckily in only one place. This removes the internal unquoting so the form above works. This could easily have knock-on effects in other callers of _arguments, however they should be fixable by simple local changes (and at least one case, the one above, works without updating, so others probably do, too), while with the old code there were unfixable cases, so I think we just need to identify them and change them as they come up. So please watch out for any anomalous _arguments quoting behaviour. Index: Src/Zle/computil.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v retrieving revision 1.115 diff -u -r1.115 computil.c --- Src/Zle/computil.c 5 Aug 2009 10:14:54 -0000 1.115 +++ Src/Zle/computil.c 17 Aug 2009 20:52:20 -0000 @@ -1866,9 +1866,12 @@ Caopt ptr, wasopt = NULL, dopt; struct castate state; char *line, *oline, *pe, **argxor = NULL; - int cur, doff, argend, arglast, ne; + int cur, doff, argend, arglast; Patprog endpat = NULL, napat = NULL; LinkList sopts = NULL; +#if 0 + int ne; +#endif /* Free old state. */ @@ -1927,13 +1930,24 @@ dopt = NULL; doff = state.singles = arglast = 0; - /* remove quotes */ oline = line; +#if 0 + /* + * remove quotes. + * This is commented out: it doesn't allow you to discriminate + * between command line values that can be expanded and those + * that can't, and in some cases this generates inconsistency; + * for example, ~/foo\[bar unqotes to ~/foo[bar which doesn't + * work either way---it's wrong if the ~ is quoted, and + * wrong if the [ isn't quoted.. So it's now up to the caller to + * unquote. + */ line = dupstring(line); ne = noerrs; noerrs = 2; parse_subst_string(line); noerrs = ne; +#endif remnulargs(line); untokenize(line); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/