zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayne@opencoder.net>
To: Zsh list <zsh-workers@zsh.org>
Subject: Re: Non-escaped special chars from var expansion
Date: Sat, 16 Nov 2019 22:00:07 -0800	[thread overview]
Message-ID: <CAHSx_Sszo7uzoebZN2ZF0wbOimSu-RArDk+Gz38fGG_r_yguLA@mail.gmail.com> (raw)
In-Reply-To: <CAHSx_Svj04+0L2Lcxymegscn9aG+fsuE6jnv7cQvD67oprE1mA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

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@opencoder.net> 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..

      parent reply	other threads:[~2019-11-17  6:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 20:39 Wayne Davison
2018-11-02 22:06 ` Peter Stephenson
2018-11-03 19:49   ` Peter Stephenson
2018-11-02 23:21 ` Wayne Davison
2019-11-17  6:00 ` Wayne Davison [this message]

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=CAHSx_Sszo7uzoebZN2ZF0wbOimSu-RArDk+Gz38fGG_r_yguLA@mail.gmail.com \
    --to=wayne@opencoder.net \
    --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).