zsh-workers
 help / color / mirror / code / Atom feed
* A cute bug involving aliases and _remote_files
@ 2019-02-26  2:49 Philippe Troin
  2019-02-26  9:23 ` dana
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Troin @ 2019-02-26  2:49 UTC (permalink / raw)
  To: Zsh hackers list

Hi,

I have the following aliases in my .zshenv:
  alias ls='command ls -Fbv'

The interesting part there is the "-b" which instructs ls to quote
unprintable characters and spaces.

But in _remote_files we do:
  _call_program files $cmd $cmd_args $host ls -d1FL -- 
which will use the alias, and when I complete a file with a space, zsh
ends up prefixing the space with 7 backslashes, as there's now an extra
round of escaping performed.

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.
I don't need any downsides as all shells that I'm aware of have the
"command" pre-command modifier.

Example of the issue (you need to alias ls as described above for this
to show):

% mkdir test_dir
% touch test_dir/'a file'
% scp localhost:$PWD/test_dir/a
                               ^ Press TAB
===> completes to:
% scp localhost:$PWD/test_dir/a\\\\\\\ file

I have this in my .zshrc in the meantime:
     _remote_files() {
       unfunction _remote_files
       autoload +X _remote_files
       if [[ $functions[_remote_files] != *' command ls -' ]]
       then
         functions[_remote_files]=${functions[_remote_files]// ls -/ command ls -}
       fi
       _remote_files $*
     }


Yet it would be neat if this were fixed upstream.
Thanks,

Phil.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-27  8:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26  2:49 A cute bug involving aliases and _remote_files Philippe Troin
2019-02-26  9:23 ` dana
2019-02-26  9:40   ` Peter Stephenson
2019-02-27  8:27   ` Philippe Troin
2019-02-27  8:42     ` dana

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).