Subject: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p'

From: Drew Adams <[email-masked]>
Date: Tue, 25 Aug 2015 10:48:10 -0700 (PDT)

The behavior seems wrong.  If so, the regression was introduced in
Emacs 24.5.

emacs -Q

I evaluate these two sexps:

(file-accessible-directory-p
"D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001")

(directory-files
"D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001")

The first returns t.  In Emacs prior to Emacs 24.5, the second returns
nil.  In Emacs 24.5 and later I get this error:

Debugger entered--Lisp error: (file-error "Opening directory"
 "Permission denied"
 "D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001")
* directory-files(
"D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001"
 FULL
 "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")

Evaluating `file-attributes' for the same file returns this:

(t 1 37786 513
   (20885 54199 0 0)
   (20885 54199 0 0)
   (20885 54199 0 0)
   0 "drwxrwxrwx" t 0 506428215)

In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2015-07-31 on LEG570
Bzr revision: 8d332aeccab2208e6c6bd434738565e6abf12043
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --host=i686-pc-mingw32 --enable-checking=yes,glyphs'