Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Non-escaped special chars from var expansion
- X-seq: zsh-workers 44912
- From: Wayne Davison <wayne@xxxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxx>
- Subject: Re: Non-escaped special chars from var expansion
- Date: Sat, 16 Nov 2019 22:00:07 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=opencoder.net; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:content-type; s=opencoder.net; bh=8y7EYMpxiqxdv0gGZmIdvB2cQE 0=; b=EdjjGUem7OboMqZnlQHftg8RvpnWkj0ppsZBD+4Uv5/ozU6qJ5hE1JuOUu 7UZRekj7idA1263kXYQ9cLmkLkXSLzIndjjirumDJoDae19kgWAnX8O3k68v9bzC 3D6yUzOsNKcsBzFwSKHmIgrw8fUas3gBurrwNF6qUiREXv9H4=
- In-reply-to: <CAHSx_Svj04+0L2Lcxymegscn9aG+fsuE6jnv7cQvD67oprE1mA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHSx_Svj04+0L2Lcxymegscn9aG+fsuE6jnv7cQvD67oprE1mA@mail.gmail.com>
I've discovered that the prior fix for the following issue is actually
incomplete:
On Fri, Nov 2, 2018 at 1:39 PM Wayne Davison <wayne@xxxxxxxxxxxxx> wrote:
> zsh -f
> autoload -Uz compinit
> compinit
> zstyle ':completion:*' completer _oldlist _expand _complete _match
> _ignored _files _prefix
> zstyle ':completion:*:expand:*' tag-order all-expansions
> bindkey -e
> bindkey '\t' complete-word
> mkdir 'foo; bar (baz)'
> cd !:1
> cd $PWD<tab>
>
The fix works for this particular case because the attempted glob with
"(baz)" generated an error. However, I've found 2 cases that don't generate
an error where the non-glob code needs to be run, but it doesn't happen
because "done_quote=1" got set. For instance, if you just run the test
from one level deeper in that weird directory:
mkdir foo ; cd foo ; ls $PWD<tab>
That will expand to just "ls /tmp/foo;\ bar\ (baz)/foo" (the same bad
quoting as before). Alternatively, if we name the dir with some valid glob
suffix, it also fails to quote:
mkdir '/tmp/foo (#qN)'
cd !:1
ls $PWD<tab>
In both failure cases I saw that $exp was an empty string, so I tweaked the
"&& done_quote=1" part of the code (in _expand) to be "&& [[ "$exp" ]] &&
done_quote=1" and this has fixed the quoting issues I was seeing. I'm not
sure if it is the right fix, though.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author