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

From: Michael Albinus <[email-masked]>
Date: Fri, 28 Jul 2017 14:00:59 +0200

Tino Calancha <[email-masked]> writes:

> I)
> The following should match something:
> C-x d ~/src/*/gray*
>
> I got a dired buffer with 3 files:
> bitmaps/gray1.xbm
> bitmaps/gray3.xbm
> bitmaps/gray.xbm

The second time I've applied your patch it works. I get a similar
result. Don't ask me what happened before, pilot error very likely.

> II)
> 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.

This relates to your description in etc/NEWS:

*** Dired supports wildcards in the directory part of the file names.

Best regards, Michael.