From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Cc: Adrian Irving-Beer <wisq-deb@wisq.net>, 468654@bugs.debian.org
Subject: Re: Bug#468654: zsh: rsync completion fails to complete remote paths with spaces
Date: Fri, 29 Feb 2008 15:21:50 -0500 [thread overview]
Message-ID: <20080229202150.GA18766@scowler.net> (raw)
In-Reply-To: <20080229200414.GA3027@wisq.net>
On Fri, Feb 29, 2008 at 03:04:14PM -0500, Adrian Irving-Beer wrote:
> If I have the following on host 'alpha':
>
> /tmp/foo bar baz/foo
> /tmp/foo bar baz/bar
> /tmp/foo bar baz/baz
>
> I can do this:
>
> % rsync alpha:/tmp/foo<TAB>
> --> % rsync alpha:/tmp/foo\\\ bar\\\ baz/
>
> But I can't continue:
>
> % rsync alpha:/tmp/foo\\\ bar\\\ baz/<TAB>
> --> no response
>
> Tracing this, I found that it ran a failing 'ls' via ssh, something akin
> to this:
>
> ssh -a -x alpha ls -d1FL "/tmp/foo bar baz/*"
>
> This fails because the quoting only makes the argument appear as a
> single argument to 'ssh'; when ssh passes the command to the remote
> host, it comes out as trying to list three different files.
>
> The solution is to double-quote the parameter, akin to this:
>
> ssh -a -x alpha ls -d1FL "\"/tmp/foo bar baz/\"*"
>
> I've attached a patch. I'm no zsh expert, so it needs review -- I
> don't know if I've fixed one thing and broken another. But it does
> seem to work for this situation.
>
> --- /usr/share/zsh/functions/Completion/Unix/_rsync 2008-02-28 00:39:09.000000000 -0500
> +++ /usr/share/zsh-beta/functions/Completion/Unix/_rsync 2008-02-29 14:46:52.000000000 -0500
> @@ -58,7 +58,7 @@
> elif compset -P 1 '*:'; then
>
> if zstyle -T ":completion:${curcontext}:files" remote-access; then
> - remfiles=(${(M)${(f)"$(_call_program files ssh -a -x ${IPREFIX%:} ls -d1FL "${(Q)PREFIX%%[^./][^/]#}\*" 2>/dev/null)"}%%[^/]#(|/)})
> + remfiles=(${(M)${(f)"$(_call_program files ssh -a -x ${IPREFIX%:} ls -d1FL "\"${(Q)PREFIX%%[^./][^/]#}\"\*" 2>/dev/null)"}%%[^/]#(|/)})
> compset -P '*/'
> compset -S '/*' || suf='remote file'
Maybe _rsync should get the same QIPREFIX check as _ssh and _git, or
maybe all three of these should be factored out into a helper function.
next parent reply other threads:[~2008-02-29 20:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080229200414.GA3027@wisq.net>
2008-02-29 20:21 ` Clint Adams [this message]
2008-03-01 0:57 ` Clint Adams
2008-03-02 21:11 ` Adrian Irving-Beer
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=20080229202150.GA18766@scowler.net \
--to=schizo@debian.org \
--cc=468654@bugs.debian.org \
--cc=wisq-deb@wisq.net \
--cc=zsh-workers@sunsite.dk \
/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).