Subject: bug#27631: dired a/*/b

From: Tino Calancha <[email-masked]>
Date: Sat, 29 Jul 2017 21:20:35 +0900 (JST)

On Fri, 28 Jul 2017, Michael Albinus wrote:

>> If i try I) with tramp, for instance calling sudo:
>> /sudo:calancha@calancha-pc:/home/calancha/soft/emacs-master/src/*/gray* RET
>> then i get:
>>
>> tramp-file-name-handler: Couldn’t ‘cd /home/calancha/soft/emacs-master/src/\*/’
>
> Same error here. The backtrace shows me:
>
> --8<---------------cut here---------------start------------->8---
>  tramp-file-name-handler(insert-directory "/ssh:localhost:/home/albinus/src/emacs/src/*/gray*" "--dired -al" t nil)
>  insert-directory("/ssh:localhost:/home/albinus/src/emacs/src/*/gray*" "--dired -al" t nil)
>  dired-insert-directory("/ssh:localhost:/home/albinus/src/emacs/src/*/gray*" "-al" nil t t)
>  dired-readin-insert()
>  dired-readin()
>  dired-internal-noselect("/ssh:localhost:/home/albinus/src/emacs/src/*/gray*" nil)
>  dired-noselect("/ssh:localhost:~/src/emacs/src/*/gray*" nil)
>  dired("/ssh:localhost:~/src/emacs/src/*/gray*" nil)
>  funcall-interactively(dired "/ssh:localhost:~/src/emacs/src/*/gray*" nil)
>  call-interactively(dired nil nil)
>  command-execute(dired)
> --8<---------------cut here---------------end--------------->8---
>
> I believe it is wrong to expand wilcards in `insert-directory'. It is
> not designed for that. Expanding must happen in
> `dired-insert-directory', which calls then `insert-directory' for the
> results.
Hi Michael,

thank you for your advice on this.  I have a new version which handle the
expansion in `dired-insert-directory'.  I pushed a new branch with
the newest patch:
origin/feature/dired-wildcard-in-dir-bug#27631

When the user is neither using 'ls-lisp' nor 'eshell-ls', then we run 
in the remote host something like:
(process-file "/bin/sh" nil (current-buffer) nil "-c" (format "ls %s %s" switches wildcard)))

I have tested it running tramp in a remote machine and it seems to work.
What do you think?

Tino