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

Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too soon]

>   > Yes.  Well, kind of.  It's an eval issue.  The call to _call_program
>   > (which I have removed) causes the wildcard to be expanded too early
>   > because it calls eval.  Here's a trace excerpt.
>   I haven't tried this at all, but maybe this will fix your problem.

>   [removed patch that encloses ls args in ""]

Yes, this works and has the advantage that it doesn't clobber any
other advantage of using _call_program.  I would still suggest adding
"L" to the ls arguments so that valid (non-dangling) symbolic links to
directories complete with a trailing slash.

Off hand, I'm not able to think of a compelling reason why this would
fail.  It seems to behave properly even with double quote characters
or spaces in the file name (as does my original patch).

To me, something feels cleaner and safer about avoiding the
unnecessary eval than enclosing everything in an extra set of quotes,
This will probably break if _call_program is changed to do what it
does differently.  On the other hand, since I'll admit to not
completely understanding what the purpose of _call_program is (it
looks to me like it provides a mechanism for using zstyle to tell zsh
that command names should be completed at a given point in expanding a
program's argument), I wouldn't try to argue that my original patch is

Note that _ssh and _rlogin both have remote_files functions that do
not call _call_program.  _ssh used to before my previous patch but now

Here's a new patch that is identical to yours except that it adds the
"L" to the ls arguments.

--- _rsync.qdist	2004-03-25 13:29:33.000000000 -0500
+++ _rsync	2004-04-13 12:11:36.000000000 -0400
@@ -37,8 +37,8 @@
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    remfiles=(${(f)"$(_call_program files ssh -a -x ${words[CURRENT]%:*} ls -d1F ${${${words[CURRENT
-]#*:}:h}/${slash}(#e)/}/\* 2>/dev/null)"})
+    remfiles=(${(f)"$(_call_program files ssh -a -x ${words[CURRENT]%:*} ls -d1FL "${${${words[CURRENT
+]#*:}:h}/${slash}(#e)/}/\* 2>/dev/null")"})

Jay Berkenbilt <ejb@xxxxxx>

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