Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too soon]
- X-seq: zsh-workers 19769
- From: Jay Berkenbilt <ejb@xxxxxx>
- To: clint@xxxxxxx
- Subject: Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too soon]
- Date: Tue, 13 Apr 2004 12:17:33 -0400
- Cc: zsh-workers@xxxxxxxxxx, 243385@xxxxxxxxxxxxxxx
- In-reply-to: <20040413021931.GA10355@xxxxxxxxxxx> (clint@xxxxxxx)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040413012117.GA9729@xxxxxxxxxxx> <200404130137.i3D1b5CW004764@xxxxxxxxxxxxxx> <20040413021931.GA10355@xxxxxxxxxxx>
> > 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
better.
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
doesn't.
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
slash=/
- 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")"})
remdispf=(${remfiles:#*/})
remdispd=(${(M)remfiles:#*/})
--
Jay Berkenbilt <ejb@xxxxxx>
http://www.ql.org/q/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author