From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Bug: cd auto-completion of .. fails with parentheses in directory name
Date: Sat, 29 Oct 2016 18:06:32 +0000 [thread overview]
Message-ID: <20161029180632.GA18192@fujitsu.shahaf.local2> (raw)
In-Reply-To: <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@brasslantern.com> 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"
next prev parent reply other threads:[~2016-10-29 18:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 6:12 Georg Nebehay
2016-09-22 14:42 ` Daniel Shahaf
2016-09-22 17:30 ` Bart Schaefer
2016-10-28 1:56 ` Mikael Magnusson
2016-10-28 15:10 ` Daniel Shahaf
2016-10-29 18:06 ` Daniel Shahaf [this message]
2016-10-29 18:39 ` Peter Stephenson
2016-10-29 19:44 ` Bart Schaefer
2016-10-31 3:22 ` Daniel Shahaf
2016-11-27 15:17 ` Daniel Shahaf
2016-11-27 18:30 ` Mikael Magnusson
2016-11-27 18:32 ` Mikael Magnusson
2016-11-27 18:39 ` Mikael Magnusson
2016-11-28 19:30 ` Bart Schaefer
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=20161029180632.GA18192@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=mikachu@gmail.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).