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

Re: A cute bug involving aliases and _remote_files

On 25 Feb 2019, at 20:49, Philippe Troin <phil@xxxxxxxx> wrote:
>Would it make sense to use "command ls" instead of "ls" for remote
>directory listings in _remote_files?  That would make sure that no
>aliases nor functions are involved.

That *seems* reasonable...?

Now that you mention it, GNU ls changed its default quoting behaviour somewhat
recently. I think it only quotes when (a) QUOTING_STYLE is set, (b) one of the
quoting options is given on the command line, or (c) the output is a TTY — so
it's unlikely to be an issue for _remote_files, given how it's normally used.
But maybe it'd be a good idea to force it off anyway, just in case?


diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files
index 267715a51..89cf102cf 100644
--- a/Completion/Unix/Type/_remote_files
+++ b/Completion/Unix/Type/_remote_files
@@ -59,7 +59,10 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
   # remote filenames
-  remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args $host ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
+  remfiles=(${(M)${(f)"$(
+    _call_program files $cmd $cmd_args $host \
+      QUOTING_STYLE=literal command ls -d1FL -- "$rempat" 2>/dev/null
+  )"}%%[^/]#(|/)})
   compset -P '*/'
   compset -S '/*' || (( ${args[(I)-/]} )) || suf='remote file'

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