Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Quoting problems with _zip (unzip) completer



On Mon, Aug 17, 2009 at 23:49, Peter
Stephenson<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Mon, 17 Aug 2009 21:58:19 +0100
> Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> 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 <TAB>
>
> 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 <array>" was
> broken: Âinstead of appending the contents of <array> after the -F to
> the contents of the existing array, it appended the name <array>.

Great!

> (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 don't want to sound pessimistic, but aren't we approaching a point
where the quoting and pattern matching code simply has to be
re(written|factored)?  I'm not volunteering, but it seems that more or
less every bug fix goes something like "OK, I'm not sure what this
code is supposed to do, but it seems to work if we do X first".  Who
wrote the quoting and pattern matching code?  Was it Sven?  Is he not
available to document this kind of stuff any longer?

I hope I don't sound critical of the development process.  I have no
right to be.  I just thought I'd mention my observation, seeing as I
failed to do so for the one below.

> 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".

I must confess that I had noticed it, but ignored it, figuring that my
code was broken and that it had been fixed in CVS.  I should have
investigated this, and for not doing so I apologize.



Messages sorted by: Reverse Date, Date, Thread, Author