Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [glisse@xxxxxxxxxxxxxxxxx: Bug#307341: zsh: insufficient escaping of spaces in _ssh completion]



On May 2,  1:10pm, Clint Adams wrote:
} Subject: [glisse@xxxxxxxxxxxxxxxxx: Bug#307341: zsh: insufficient escaping
}
} ----- Forwarded message from Marc Glisse <glisse@xxxxxxxxxxxxxxxxx> -----
} 
} scp somehost:/data/a<TAB>
} scp somehost:/data/a\\\ a/
} But when I press <TAB> again, it fails, as if directory 'a a' did not
} exist. 
} 
} ----- End forwarded message -----

I think this deals with it.  Does anyone remember in what case we might
need (Q) applied to the prefix?  Some mixture of quoting forms, perhaps?

Index: Completion/Unix/Command/_ssh
===================================================================
diff -c -r1.14 _ssh
--- Completion/Unix/Command/_ssh	6 Dec 2004 16:51:17 -0000	1.14
+++ Completion/Unix/Command/_ssh	7 May 2005 17:08:15 -0000
@@ -2,11 +2,15 @@
 
 _remote_files () {
   # There should be coloring based on all the different ls -F classifiers.
-  local expl remfiles remdispf remdispd args suf ret=1
+  local expl rempat remfiles remdispf remdispd args suf ret=1
 
   if zstyle -T ":completion:${curcontext}:files" remote-access; then
     zparseopts -D -E -a args p: 1 2 4 6 F:
-    remfiles=(${(M)${(f)"$(_call_program files ssh $args -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 $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 



Messages sorted by: Reverse Date, Date, Thread, Author