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

Re: zsh-4.2.0-pre-4: problems with _remote_files



On Fri, Mar 19, 2004 at 06:07:22PM +0300, Alexey Tourbin wrote:
> I've been testing zsh-4.2.0-pre-4 for a while, along with Alexey Voinov.
> We've noticed a few problems with _remote_files completion (ssh).

I've tracked down the problem: using _call_program requires extra
quoting because of additional level of indirection inside eval "$argv".

Here is what happens when _remote_files is invoked.

$ touch \'
$ ssh -a -x localhost ls -d1F \*
<file list> -- works fine

$ _call_program files ssh -a -x localhost ls -d1F \*
zsh: unmatched '

You see, the same command wrapped into _call_program doesn't work.
And what it should be:

$ _call_program files ssh -a -x localhost ls -d1F \\\*
<file list> -- now works

The following patch solves the problem.

--- zsh-4.2.0/Completion/Unix/Command/_ssh-	2004-02-24 13:00:50 +0000
+++ zsh-4.2.0/Completion/Unix/Command/_ssh	2004-03-24 19:55:58 +0000
@@ -6,7 +6,7 @@ _remote_files () {
 
   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 -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
+    remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\\\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 

Attachment: pgpTzAZw6f4U0.pgp
Description: PGP signature



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