zsh-workers
 help / color / mirror / code / Atom feed
From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Peter Stephenson <pws@csr.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Quoting problems with _zip (unzip) completer
Date: Thu, 4 Feb 2010 09:15:46 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1002040835330.2729@hp.internal> (raw)
In-Reply-To: <20100204113745.0a9a8234@news01>

On Thu, 4 Feb 2010, Peter Stephenson wrote:

> On Wed, 3 Feb 2010 22:09:58 +0000
> Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > On Wed, 3 Feb 2010 02:16:15 +0100
> > Mikael Magnusson <mikachu@gmail.com> wrote:
> > > On 17 August 2009 21:58, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > > > On Tue, 04 Aug 2009 09:50:59 +0100
> > > > Peter Stephenson <pws@csr.com> wrote:
> > > >> Mikael Magnusson wrote:
> > > >> > % unzip test\[.zip <tab>
> > > >> > _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 exact test above is currently working for me, with my default
> > completion setup.
> 
> It's working starting from zsh -f just loading compinit, too.  I tried 
> another vanilla version of zsh just to make sure.
> 
> If the other part of the thread doesn't yield anything, could you see 
> if you can find what's breaking it, in terms of shell settings or 
> environment?  (To be quite clear: I'm not going to be doing this 
> myself without some indication of what to do.)

I get brokenness with stock options.

$ zsh -f +d
host% mkdir /tmp/zshzip
host% cd /tmp/zshzip
host% mkdir foo
host% touch foo/bar
host% zip -r 'test[.zip' foo
  adding: foo/ (stored 0%)
  adding: foo/bar (stored 0%)
host% rm -rf foo
host% autoload compinit
host% compinit -d ./compinit
host% unzip 'test[.zip' <TAB>
_zip:117: bad pattern: test[.zip(|.zip|.ZIP)
host% unzip 'test[.zip' <cursor>

(commands only, for copypasting):
zsh -f +d
mkdir /tmp/zshzip
cd /tmp/zshzip
mkdir foo
touch foo/bar
zip -r 'test[.zip' foo
rm -rf foo
autoload compinit
compinit -d ./compinit


> Ben wrote:
> > Breaks for me w/ latest git.  Changing _zip line 117:
> > from      zipfile=( $~line[1](|.zip|.ZIP) )
> > to        zipfile=( $line[1](|.zip|.ZIP) )
> > 
> > fixes the 'test[.zip' case
> 
> This isn't a proper fix.  If you want to play along, read and digest 
> the description with my first patch.  The key point is to keep 
> ~-expansion working.

My bad.  Yep, I obviously glossed over that.


> However, this form does certainly have the globbing problems you 
> pointed out.  $~ is doing multiple things not all of which we want; I 
> wonder if this might be causing other problems, too.  It's annoyingly 
> hard to get the effect of file expansion and removal of quotes without 
> the effect of globbing, but a scalar assignment with $~ and an 
> explicit unquote seems to do the trick.  Does changing it along the 
> lines of this patch fix the original problem?

Yes.  That works for me for the Zsh pattern problem.  Still exploring 
the zipinfo problem.


> Index: Completion/Unix/Command/_zip
> +      if [[ $zipfile !=  $_zip_cache_list ]]; then
> +        _zip_cache_name="$zipfile"

Shouldn't the first line there be $_zip_cache_list be $_zip_cache_name?  
(The problem was there before your patch [line 119 prepatch, 128 post])  
Otherwise I don't think it'll ever cache the list.

-- 
Best,
Ben


  reply	other threads:[~2010-02-04 14:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 20:15 Mikael Magnusson
2009-08-04  8:50 ` Peter Stephenson
2009-08-04 16:31   ` Mikael Magnusson
2009-08-17 20:58   ` Peter Stephenson
2009-08-17 21:49     ` Peter Stephenson
2009-08-17 21:59       ` Nikolai Weibull
2009-08-18  9:10         ` Peter Stephenson
2010-02-03  1:16     ` Mikael Magnusson
2010-02-03 22:09       ` Peter Stephenson
2010-02-03 22:43         ` Mikael Magnusson
2010-02-03 23:11           ` Benjamin R. Haskell
2010-02-03 23:21             ` Benjamin R. Haskell
2010-02-04 10:03           ` Peter Stephenson
2010-02-04 11:37         ` Peter Stephenson
2010-02-04 14:15           ` Benjamin R. Haskell [this message]
2010-02-04 14:22             ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1002040835330.2729@hp.internal \
    --to=zsh@benizi.com \
    --cc=pws@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).