Package: zsh
Version: 4.3.5-4
Severity: normal
Tags: patch

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.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (400, 'testing'), (300, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zsh depends on:
ii  libc6                     2.7-5          GNU C Library: Shared libraries
ii  libcap1                   1:1.10-14      support for getting/setting POSIX.
ii  libncursesw5              5.6+20080119-1 Shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libpcre3                      7.4-1      Perl 5 Compatible Regular Expressi

-- debconf information:
  zsh/rcmove:
--- /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'
 

Attachment: signature.asc
Description: Digital signature

Reply via email to