Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: cd auto-completion of .. fails with parentheses in directory name
- X-seq: zsh-workers 39757
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: Bug: cd auto-completion of .. fails with parentheses in directory name
- Date: Sat, 29 Oct 2016 18:06:32 +0000
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=OdrZvuHAvPg6VjchWf4ZSwRl+t8=; b=jor9FUys1IssGFa4mAePo lUQ8qHspPxrlLSTQDQ37WOR+rGQocoXfG8NI0thh9Ke4o9dJdmFw4tPDzE9wCTw3 ccqUqdZq2HPXW6Q4FytV8MvqN3lTHOPA//zUJ5UZ7y8MV92Lv935qp2tTZNHNg3U VpvKAsxXIdAeqJhl41Qsf0=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=OdrZvuHAvPg6VjchWf4ZSwRl+t8=; b=Gm373EZQkF2IIjY9IyuM Idk3dN8Sp846zLejPoFUl8W9sB+5H1h4Z3glgVRl5BaEkw6cluV4LnhfBOy7OsG0 XQbJrOfFeJ2qsEJlC3OkwLoOvUtC3UBNkh6+5o86oyHbWltMQ++AV6AK/O4u8iYq UKcOmJfHR/2dWguy4gWInuM=
- In-reply-to: <20161028151037.GA10483@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAPnWG_TR7DC7h36m-jp6PnuY=M4ViwwWNMtaT9aU4wawygzoBg@mail.gmail.com> <20160922144250.GA11076@fujitsu.shahaf.local2> <160922103042.ZM7407@torch.brasslantern.com> <CAHYJk3QmMUr0_C0-aAMYCNsmeXuo14JzVXwuimBk05meeX88wA@mail.gmail.com> <20161028151037.GA10483@fujitsu.shahaf.local2>
Daniel Shahaf wrote on Fri, Oct 28, 2016 at 15:10:37 +0000:
> 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.
The following fixes it without breaking the original case; however, the
comment is a Sven original so I'm a bit wary of contravening it.
There are comments throughout the function asking which variables are
shell-quoted, pattern-quoted, or unquoted filenames. In particular
there's such a comment in relation to $donepath, a variable which
depends on preserve-prefix and affects $tmp1 in the first iteration.
(In Mikael's example its value is "".)
We should get the data flow and data types of _path_files and compfiles
clarified and documented. Until then, all these fixes will be just
shots in the dark.
As to this patch, however, I don't trust it enough to commit it. We
could revert the previous patch (workers/39412) to prevent a regression
from 5.2... but given that that patch prevents «cd 'foo(+pwd)'; cd
../<TAB>» from running the 'pwd' command, I'm not so keen on reverting
it, either.
Suggestions, anyone?
Cheers,
Daniel
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 0d36b54..32942d7 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -594,7 +594,7 @@ for prepath in "$prepaths[@]"; do
# There are more components, so skip over the next components and make a
# slash be added.
- tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )
+ #tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )
tmp2="${(M)tpre##${~skips}}"
if [[ -n "$tmp2" ]]; then
skipped="/$tmp2"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author