From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3568 invoked from network); 4 Aug 2009 16:40:00 -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; 4 Aug 2009 16:40:00 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 508 invoked from network); 4 Aug 2009 16:31:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Aug 2009 16:31:53 -0000 Received: (qmail 19745 invoked by alias); 4 Aug 2009 16:31:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27207 Received: (qmail 19725 invoked from network); 4 Aug 2009 16:31:45 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 Aug 2009 16:31:45 -0000 Received: from mail-ew0-f221.google.com (mail-ew0-f221.google.com [209.85.219.221]) by bifrost.dotsrc.org (Postfix) with ESMTP id 18FCB810A3C5 for ; Tue, 4 Aug 2009 18:31:32 +0200 (CEST) Received: by ewy21 with SMTP id 21so3892780ewy.45 for ; Tue, 04 Aug 2009 09:31:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=vXs0oNkMuISCwO3rrCLrYZVASuJ+OdOJLGw4Rs0ffK8=; b=F37/bJo8CfG1AJ6fcAM6zoGJt42JSaSmiTsI0cXvYkoyMfToCIJutxfE8MiobCCv9T EGQ0OV8W3Ck9DYfl/ETfTieP13k099tKjJEl8nbxj6hYvf1gANPm7b9f8ALLXlPr6j4S YA5oxvuvENuf0u0raXCwBt3Ucc4JY+8NpShFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=bqvI118c/PMaXALhJCu8Z6u3qQl2x3WixGKy+st+3Q8G6J7Dk4FlbhZl1F3Y6FOBBg bFxw4Z62CCe2g6ZoyBta9jKDjskx0OEivoU099M4PCMHj7UbxG4eESvX+2xyLYX9uY5t w4rOL53JcujAY318MHPNE5Z67sT7e4kJ7Y8Os= MIME-Version: 1.0 Received: by 10.211.168.4 with SMTP id v4mr9198105ebo.29.1249403491218; Tue, 04 Aug 2009 09:31:31 -0700 (PDT) In-Reply-To: <200908040850.n748oxlc011862@news01.csr.com> References: <237967ef0908031315u72fa3661i17ff7f0107b85b9c@mail.gmail.com> <200908040850.n748oxlc011862@news01.csr.com> Date: Tue, 4 Aug 2009 18:31:31 +0200 Message-ID: <237967ef0908040931k5e3f547ckf0fd52a083575cca@mail.gmail.com> Subject: Re: Quoting problems with _zip (unzip) completer From: Mikael Magnusson To: zsh-workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.94.2/9651/Tue Aug 4 16:58:50 2009 on bifrost X-Virus-Status: Clean 2009/8/4 Peter Stephenson : > 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) >> >>.. >> @@ -114,7 +114,7 @@ case $state in >> if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then >> _wanted files expl zfile _files -g >> '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return >> else >> - zipfile=( $~line[1](|.zip|.ZIP) ) >> + zipfile=( $line[1](|.zip|.ZIP) ) >> [[ -z $zipfile[1] ]] && return 1 >> if [[ $zipfile[1] != $_zip_cache_list ]]; then >> _zip_cache_name="$zipfile[1]" > > The trouble is this stops you using filenames with a ~, among other > things. This suggests the value of "line" 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. I would argue it is better without the $~; I can replace the ~ with $PWD on the commandline, but I can't rename the file to not have brackets without actually renaming it. I came up with a reproducible test case for the other issue: % mkdir '[test] a name with spaces' % touch '[test] a name with spaces'/{'a file with spaces','another file with spaces',a file with a unique name','afilewithoutspaces'} % zip -r test.zip '[test] a name with spaces' % unzip test.zip # -> gives "\[test\]\ a\ name\ with\ spaces " with the space after % unzip test.zip \[test\]\ a\ name\ with\ spaces # -> just adds the space back % unzip test.zip \[test\]\ a\ name\ with\ spaces/ # -> \[test\]\ a\ name\ with\ spaces/afilewithoutspaces % unzip test.zip \[test\]\ a\ name\ with\ spaces/a # same % unzip test.zip \[test\]\ a\ name\ with\ spaces/an # -> "\[test\]\ a\ name\ with\ spaces/another\ file\ with\ spaces " # (as a unique match) % unzip test.zip \[test\]\ a\ name\ with\ spaces/a\ file # just beeps, ie no matches calling the directory 'normaldirectoryname' causes the directory to get a slash appended at the first step, but the files inside then behave exactly the same as above. According to _complete_debug the whole array of filenames gets passed down along the chain, it should be available here for some time: http://mika.l3ib.org/zsh-zip-complete-debug.txt -- Mikael Magnusson