From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c91b0e45 for ; Tue, 26 Feb 2019 02:50:15 +0000 (UTC) Received: (qmail 13844 invoked by alias); 26 Feb 2019 02:50:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44084 Received: (qmail 9130 invoked by uid 1010); 26 Feb 2019 02:50:00 -0000 X-Qmail-Scanner-Diagnostics: from granite.fifsource.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25370. spamassassin: 3.4.2. Clear:RC:0(173.255.216.206):SA:0(-1.9/5.0):. Processed in 1.637712 secs); 26 Feb 2019 02:50:00 -0000 X-Envelope-From: phil@fifi.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at fifi.org designates 173.255.216.206 as permitted sender) Message-ID: <0d066d726a76a85461089339e25e207663d389b7.camel@fifi.org> Subject: A cute bug involving aliases and _remote_files From: Philippe Troin To: Zsh hackers list Date: Mon, 25 Feb 2019 18:49:23 -0800 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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.