Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [bug] escaping spaces in _canonical_paths
- X-seq: zsh-workers 40813
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [bug] escaping spaces in _canonical_paths
- Date: Fri, 10 Mar 2017 05:53:42 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=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=vhmOsgF1XTSR05w uoQq6oT2Q8/M=; b=LTso8uybL55/KgGjvk2O/1qSWhu6U3z0W6zpo61MvNQG4G8 CrnOiy7oXZOhcrauelz1AfOWBSXvOkTebuRAF1cpjH4mvepOTsnWHvjw98dTyadS RqdfDo2VF82P5S/mk51T8dqoF247+BoqncSLiO1zwiIXlYIFJG7zv+zu3q4c=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=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=vhmOsgF1XTSR05 wuoQq6oT2Q8/M=; b=XmCQbsVTUDMBlmAWpafgPQNcp37G+BZev59zpys94qzJZe BHHZbbz7hehsPqYHo8eQLlc49FqU+WcrB01/pz3j11Cj4hoihqiZ4lJ4KfAyjO8R WfM3Ft3GqJhPpQQfrkfDZa55Q8rx72MXFZGmyCcnj55A/Sej4SkV5L9jr95Xs=
- In-reply-to: <170309214820.ZM30638@torch.brasslantern.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <87a88yk32i.fsf@mure.haselwarter.org> <170309214820.ZM30638@torch.brasslantern.com>
Bart Schaefer wrote on Thu, Mar 09, 2017 at 21:48:20 -0800:
> On Mar 6, 10:16am, Philipp G. Haselwarter wrote:
> }
> } however, if I cd into /mnt and then try to umount the relative path
> }
> } # cd /mnt
> } # umount nam
> }
> } it gets completed to
> }
> } # umount name with spaces
> }
> } with no escapes for the spaces.
>
> This seems to do it, although I haven't figured out why it is necessary
> to do the quote manipulation in the shell code here when it is not needed
> in the other (absolute-path) branch.
Perhaps the abspath branch gets confused on mountpoint names that
contain literal ' characters? Since the ${foo/bar/baz} replacement is
done on the compadd results, and compadd wasn't called with -Q.
(Can't test this right now)
> diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths
> index 6eab7b6..630907b 100644
> --- a/Completion/Unix/Type/_canonical_paths
> +++ b/Completion/Unix/Type/_canonical_paths
> @@ -41,7 +41,11 @@ _canonical_paths_add_paths () {
> # ### Ideally, this codepath would do what the 'if' above does,
> # ### but telling compadd to pretend the "word on the command line"
> # ### is ${"the word on the command line"/$origpref/$canpref}.
> - matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
> + if [[ -z $compstate[quote] ]]; then
> + matches+=(${(q)${(M)files:#$canpref*}/$canpref/$origpref})
> + else
> + matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
> + fi
> fi
>
> for subdir in $expref?*(@); do
> @@ -84,7 +88,7 @@ _canonical_paths() {
> files+=($@:P)
> fi
>
> - local base=$PREFIX
> + local base=${(Q)PREFIX}
> typeset -i blimit
>
> _canonical_paths_add_paths $base
Messages sorted by:
Reverse Date,
Date,
Thread,
Author