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

Re: Bug: cd auto-completion of .. fails with parentheses in directory name



Mikael Magnusson wrote on Fri, Oct 28, 2016 at 03:56:08 +0200:
> On Thu, Sep 22, 2016 at 7:30 PM, Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > On Sep 22,  2:42pm, Daniel Shahaf wrote:
> > }
> > } 1) Is the lifetime correct?  I'm not sure whether elemnts of 'l' should
> > } be malloc()ed or heap allocated.
> >
> > I think you have this correct -- completion is designed to put nearly
> > all of its data in a private zsh heap that is discarded all at once
> > when control returns to the line editor.  Only specific bits that persist
> > across calls go into directly-malloc'd memory.
> >
> > } 2) Should quoting be added in bin_compfiles() or at a later point during
> > } cf_pats()?  Although the docstring of cfp_test_exact() says the elements
> > } of 'l' are filenames, they are then passed to ztat() which ignores
> > } backslashes, so it's not clear to me what quoting is expected where.
> >
> > I think you have this in the right place, too, but I would be glad to
> > have someone else confirm.  Or we can just put it in and see if any
> > other examples break.
> 
> This patch breaks completion of
> % mkdir '[a]'; touch '[a]/foo'
> % ls \[a\]/<tab> # gives no results
> 
> for me. Reverting it on current master fixes it.

The new quotestring() is called in the input «\[a\]», (5 bytes), so it
becomes double-escaped.

Added to my list.



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