* Re: Bug#468654: zsh: rsync completion fails to complete remote paths with spaces
[not found] <20080229200414.GA3027@wisq.net>
@ 2008-02-29 20:21 ` Clint Adams
2008-03-01 0:57 ` Clint Adams
0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2008-02-29 20:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Adrian Irving-Beer, 468654
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug#468654: zsh: rsync completion fails to complete remote paths with spaces
2008-02-29 20:21 ` Bug#468654: zsh: rsync completion fails to complete remote paths with spaces Clint Adams
@ 2008-03-01 0:57 ` Clint Adams
2008-03-02 21:11 ` Adrian Irving-Beer
0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2008-03-01 0:57 UTC (permalink / raw)
To: zsh-workers, Adrian Irving-Beer, 468654
On Fri, Feb 29, 2008 at 03:21:50PM -0500, Clint Adams wrote:
> 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.
Adrian, does this do the trick?
Index: Completion/Unix/Command/_rsync
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rsync,v
retrieving revision 1.39
diff -u -r1.39 _rsync
--- Completion/Unix/Command/_rsync 15 Dec 2007 16:45:38 -0000 1.39
+++ Completion/Unix/Command/_rsync 1 Mar 2008 00:54:56 -0000
@@ -58,7 +58,11 @@
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)"}%%[^/]#(|/)})
+ if [[ -z $QIPREFIX ]]
+ then rempat="${PREFIX%%[^./][^/]#}\*"
+ else rempat="${(q)PREFIX%%[^./][^/]#}\*"
+ fi
+ remfiles=(${(M)${(f)"$(_call_program files ssh -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
compset -P '*/'
compset -S '/*' || suf='remote file'
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug#468654: zsh: rsync completion fails to complete remote paths with spaces
2008-03-01 0:57 ` Clint Adams
@ 2008-03-02 21:11 ` Adrian Irving-Beer
0 siblings, 0 replies; 3+ messages in thread
From: Adrian Irving-Beer @ 2008-03-02 21:11 UTC (permalink / raw)
To: zsh-workers, 468654
[-- Attachment #1: Type: text/plain, Size: 120 bytes --]
On Fri, Feb 29, 2008 at 07:57:55PM -0500, Clint Adams wrote:
> Adrian, does this do the trick?
Indeed, it works fine.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-02 21:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20080229200414.GA3027@wisq.net>
2008-02-29 20:21 ` Bug#468654: zsh: rsync completion fails to complete remote paths with spaces Clint Adams
2008-03-01 0:57 ` Clint Adams
2008-03-02 21:11 ` Adrian Irving-Beer
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).