From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' Date: Tue, 25 Aug 2015 21:10:55 +0300 Message-ID: <83fv37fdcg.fsf@gnu.org> References: <2974d023-5059-414f-960d-273fbeaca5de@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1440526345 25822 80.91.229.3 (25 Aug 2015 18:12:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2015 18:12:25 +0000 (UTC) Cc: 21346@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 25 20:12:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZUIhg-0002Rv-Fl for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 20:12:12 +0200 Original-Received: from localhost ([::1]:33968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUIhf-0006a6-Tr for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 14:12:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUIhb-0006Zo-On for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 14:12:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUIhW-0003EG-Pf for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 14:12:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUIhW-0003Dy-Nd for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 14:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZUIhW-0001IW-AY for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 14:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2015 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21346-submit@debbugs.gnu.org id=B21346.14405262704929 (code B ref 21346); Tue, 25 Aug 2015 18:12:02 +0000 Original-Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 18:11:10 +0000 Original-Received: from localhost ([127.0.0.1]:38261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUIgf-0001HR-Vn for submit@debbugs.gnu.org; Tue, 25 Aug 2015 14:11:10 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:61585) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUIgd-0001HB-DL for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 14:11:08 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NTN00200H32PV00@a-mtaout22.012.net.il> for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 21:11:05 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTN00201H6HP910@a-mtaout22.012.net.il>; Tue, 25 Aug 2015 21:11:05 +0300 (IDT) In-reply-to: <2974d023-5059-414f-960d-273fbeaca5de@default> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105811 Archived-At: > Date: Tue, 25 Aug 2015 10:48:10 -0700 (PDT) > From: Drew Adams > > The behavior seems wrong. If so, the regression was introduced in > Emacs 24.5. No, Emacs 24.5 fixed a bug that existed in previous versions. > 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. The latter result was a clear bug. > 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 > "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*") This is the correct behavior in this case: you cannot access that directory (it is private to another user). Emacs 24.4 and before would silently return nil there, which is obviously bogus (there's no directory, except the root, without at least 2 entries, so what the heck does nil mean here?). I'm guessing that you cannot display that directory's contents from the Windows Explorer as well. > 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) What does the following return? (file-extended-attributes "D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001") Anyway, Windows has an elaborate file access permissions mechanism that is not reflected in the Posix-style APIs used by file-accessible-directory-p and file-attributes. So you have this inconsistency. That is unfortunate, but since Windows doesn't have any reliable API that would allow us to perform the accessibility test, we cannot really improve that situation. IOW, on Windows you can never be sure you can access a file or directory until you actually try. Fortunately, there are only a few directories on a typical Windows system where you really cannot access files. So this problem is rarely seen in practice.