Subject: bug#6297: file-expand-wildcards permission error on top-level mount point

From: MON KEY <[email-masked]>
Date: Fri, 28 May 2010 18:30:53 -0400

file-expand-wildcards permission error on top-level mount point

Evaluating (file-expand-wildcards "/*/SOME-DIR/*")

Where the first kleene's target is a mount point e.g.:
 "/mnt/SOME-DIR/*"

Signals this error:
 (file-error "Opening directory" "permission denied" "/lost+found/")

I'm not sure where the error is getting signalled whether its happening
under the root mount point e.g. "/" or if its occuring under

 "/mnt/God-knows-where/..."

On this sytem "lost+found" is the directory that was placed in an ext4
partition for recovery purposes.

It appears that `file-expand-wildcards' gets trounced via
`directory-files' which is signaling an error if the permissions
aren't kosher somewhere.

Shouldn't one of these guys be checking with `file-readable-p' or
`file-attributes' at some such at some point whilst walking the
filesytem?

The error is signalled here too:

 (file-expand-wildcards "/*/etc/*.conf")

Whereas this works fine:

 (file-expand-wildcards "/etc/*.conf")

which seems odd because in each case (error or not) the permissions
can't be more than root:root i.e. the file-list returnd by the last
form are all root:root.

Surely one shouldn't need to be considering umask/dmask/setuid
etc. just to use this function?

On a GNU Emacs 23.2.1
(i686-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-05-10

-- 
/s_P\