From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20692 invoked by alias); 4 Feb 2010 14:16:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27659 Received: (qmail 5064 invoked from network); 4 Feb 2010 14:15:52 -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-SPF: none (ns1.primenet.com.au: domain at benizi.com does not designate permitted sender hosts) Date: Thu, 4 Feb 2010 09:15:46 -0500 (EST) From: "Benjamin R. Haskell" To: Peter Stephenson cc: zsh workers Subject: Re: Quoting problems with _zip (unzip) completer In-Reply-To: <20100204113745.0a9a8234@news01> Message-ID: References: <237967ef0908031315u72fa3661i17ff7f0107b85b9c@mail.gmail.com> <200908040850.n748oxlc011862@news01.csr.com> <20090817215819.796e9416@pws-pc> <237967ef1002021716l101c98b7obc758fb200a117e8@mail.gmail.com> <20100203220958.26bc25fe@pws-pc> <20100204113745.0a9a8234@news01> User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 4 Feb 2010, Peter Stephenson wrote: > On Wed, 3 Feb 2010 22:09:58 +0000 > Peter Stephenson wrote: > > On Wed, 3 Feb 2010 02:16:15 +0100 > > Mikael Magnusson wrote: > > > On 17 August 2009 21:58, Peter Stephenson wrote: > > > > 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 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' _zip:117: bad pattern: test[.zip(|.zip|.ZIP) host% unzip 'test[.zip' (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