From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 13:49:21 2015 Received: (at submit) by debbugs.gnu.org; 25 Aug 2015 17:49:21 +0000 Received: from localhost ([127.0.0.1]:38253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUILY-0000l8-Sr for submit@debbugs.gnu.org; Tue, 25 Aug 2015 13:49:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34188) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUILX-0000l1-Aq for submit@debbugs.gnu.org; Tue, 25 Aug 2015 13:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUILV-0003zp-Rw for submit@debbugs.gnu.org; Tue, 25 Aug 2015 13:49:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUILV-0003zl-P6 for submit@debbugs.gnu.org; Tue, 25 Aug 2015 13:49:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUILU-00065W-S7 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 13:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUILR-0003yy-MA for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 13:49:16 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:21881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUILR-0003RY-Em for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 13:49:13 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7PHmB40014477 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Aug 2015 17:48:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7PHmA1i030658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 25 Aug 2015 17:48:11 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7PHmAxP008658 for ; Tue, 25 Aug 2015 17:48:10 GMT MIME-Version: 1.0 Message-ID: <2974d023-5059-414f-960d-273fbeaca5de@default> Date: Tue, 25 Aug 2015 10:48:10 -0700 (PDT) From: Drew Adams To: bug-gnu-emacs@gnu.org Subject: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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=3Di686-pc-mingw32 --enable-checking=3Dyes,glyphs' From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 14:11:10 2015 Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 18:11:10 +0000 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 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 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) 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) Date: Tue, 25 Aug 2015 21:10:55 +0300 From: Eli Zaretskii Subject: Re: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' In-reply-to: <2974d023-5059-414f-960d-273fbeaca5de@default> X-012-Sender: halo1@inter.net.il To: Drew Adams Message-id: <83fv37fdcg.fsf@gnu.org> References: <2974d023-5059-414f-960d-273fbeaca5de@default> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 14:35:00 2015 Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 18:35:00 +0000 Received: from localhost ([127.0.0.1]:38279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUJ3j-0001qZ-Ml for submit@debbugs.gnu.org; Tue, 25 Aug 2015 14:35:00 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:37631) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUJ3h-0001qR-Jm for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 14:34:58 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7PIYt1Y006870 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Aug 2015 18:34:56 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7PIYttK010748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 25 Aug 2015 18:34:55 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7PIYsUt004229; Tue, 25 Aug 2015 18:34:55 GMT MIME-Version: 1.0 Message-ID: Date: Tue, 25 Aug 2015 11:34:54 -0700 (PDT) From: Drew Adams To: Eli Zaretskii , Drew Adams Subject: RE: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' References: <<2974d023-5059-414f-960d-273fbeaca5de@default>> <<83fv37fdcg.fsf@gnu.org>> In-Reply-To: <<83fv37fdcg.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) > > 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") >=20 > This is the correct behavior in this case: you cannot access that > directory (it is private to another user). Then why does (file-accessible-directory-p "D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001") return t? The doc for that function says that it returns t if I can open the directory. > > 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) >=20 > What does the following return? >=20 > (file-extended-attributes "D:/$RECYCLE.BIN/S-1-5-21-3120201979- > 235963886-2582836866-1001") ((acl . "O:S-1-5-21-3138815620-4253048750-3916773603-37786G:S-1-5-21-312020= 1979-235963886-2582836866-513D:P(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;FA;= ;;S-1-5-21-3120201979-235963886-2582836866-1001)") (selinux-context nil nil nil nil)) What does that tell you? Does it say who the mysterious other user is, to whom the directory is private? > 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. I see. What would you suggest, in that case, for filtering out such directories, so the error is not raised? I can wrap the call in `ignore-errors' or equivalent, I suppose. But at that point it might be too late (depending on the context). And given this "inconsistency", don't you think this gotcha should be mentioned in the doc - of `file-accessible-directory-p', for example? That predicate would seem to be unusable as a general test for access to a directory. IOW, what it claims it does is hardly what it does, apparently. And perhaps we need another predicate that actually does what this one says it does, by trying to access the directory? Somewhat akin to `file-remote-p' versus `ffap-file-remote-p'. > 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. Can you characterize those "few directories"? Perhaps they can be described in the doc. Or perhaps `file-accessible-directory-p' can be taught to return nil for them. --- BTW, the doc string of `file-accessible-p' says nothing about what it returns if file FILENAME does NOT name a directory you can open. It should, I think, say what it does (returns nil, raises an error, writes to the the Secretary General of the UN, whatever). Similarly, the manual does not say explicitly that it returns nil if the dir is not accessible, but one can surmise that from the fact that it shows an example where it returns nil and the text says that this implies that attempting to access the directory raises an error. Still, like the doc string, it could be clearer. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 15:09:25 2015 Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 19:09:25 +0000 Received: from localhost ([127.0.0.1]:38285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUJb3-0002d6-3r for submit@debbugs.gnu.org; Tue, 25 Aug 2015 15:09:25 -0400 Received: from mtaout24.012.net.il ([80.179.55.180]:47910) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUJaz-0002cx-SL for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 15:09:23 -0400 Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NTN00600J4I7L00@mtaout24.012.net.il> for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 22:01:23 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTN002X1JIB7E40@mtaout24.012.net.il>; Tue, 25 Aug 2015 22:01:23 +0300 (IDT) Date: Tue, 25 Aug 2015 22:09:09 +0300 From: Eli Zaretskii Subject: Re: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' In-reply-to: X-012-Sender: halo1@inter.net.il To: Drew Adams Message-id: <83egirfane.fsf@gnu.org> References: <2974d023-5059-414f-960d-273fbeaca5de@default> <83fv37fdcg.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Tue, 25 Aug 2015 11:34:54 -0700 (PDT) > From: Drew Adams > Cc: 21346@debbugs.gnu.org > > > > 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") > > > > This is the correct behavior in this case: you cannot access that > > directory (it is private to another user). > > Then why does (file-accessible-directory-p > "D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001") > return t? I explained that later in my response. > The doc for that function says that it returns t if I can open the > directory. On Windows, that test is not reliable enough. > > What does the following return? > > > > (file-extended-attributes "D:/$RECYCLE.BIN/S-1-5-21-3120201979- > > 235963886-2582836866-1001") > > ((acl . "O:S-1-5-21-3138815620-4253048750-3916773603-37786G:S-1-5-21-3120201979-235963886-2582836866-513D:P(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;FA;;;S-1-5-21-3120201979-235963886-2582836866-1001)") > (selinux-context nil nil nil nil)) > > What does that tell you? That the file is indeed a private one. > Does it say who the mysterious other user is, to whom the directory > is private? That's not what I wanted to see there. If you want to know who is its owner, try this: (file-attributes "D:/$RECYCLE.BIN/S-1-5-21-3120201979-235963886-2582836866-1001" 'string) The name of the owner will show up as the 3rd element of the list it returns, and the name of the group (I'm guessing "None") as the 4th element. (Unless file-attributes also signals an error.) > > 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. > > I see. What would you suggest, in that case, for filtering out > such directories, so the error is not raised? > > I can wrap the call in `ignore-errors' or equivalent, I suppose. > But at that point it might be too late (depending on the context). Catching and ignoring errors is the only way, I think. > And given this "inconsistency", don't you think this gotcha should be > mentioned in the doc - of `file-accessible-directory-p', for example? Maybe. I'll have to think of a useful way of describing this. > That predicate would seem to be unusable as a general test for access > to a directory. IOW, what it claims it does is hardly what it does, > apparently. It's not unusable. It checks the read-only bit (and the executable bit for files). > And perhaps we need another predicate that actually does what this > one says it does, by trying to access the directory? It would be too expensive to be useful, I think. Just trying to read it, like you did, is good enough. > > 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. > > Can you characterize those "few directories"? Mostly, those under C:/Users/, and also in the recycle bin. Also, a small number of system directories on C:. > BTW, the doc string of `file-accessible-p' says nothing about what > it returns if file FILENAME does NOT name a directory you can open. Anything but t means it's not accessible. I think this much is clear from the doc string. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 16:55:20 2015 Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 20:55:20 +0000 Received: from localhost ([127.0.0.1]:38305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZULFX-00057r-Nl for submit@debbugs.gnu.org; Tue, 25 Aug 2015 16:55:20 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:51966) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZULFU-00057i-Jz for 21346@debbugs.gnu.org; Tue, 25 Aug 2015 16:55:17 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7PKtERb010156 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Aug 2015 20:55:15 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7PKtEEi006413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 25 Aug 2015 20:55:14 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7PKtEXO021717; Tue, 25 Aug 2015 20:55:14 GMT MIME-Version: 1.0 Message-ID: Date: Tue, 25 Aug 2015 13:55:13 -0700 (PDT) From: Drew Adams To: Eli Zaretskii , Drew Adams Subject: RE: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' References: <<2974d023-5059-414f-960d-273fbeaca5de@default>> <<83fv37fdcg.fsf@gnu.org>> <> <<83egirfane.fsf@gnu.org>> In-Reply-To: <<83egirfane.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) > > The doc for that function says that it returns t if I can open the > > directory. >=20 > On Windows, that test is not reliable enough. The doc should say that, IMO. > That's not what I wanted to see there. If you want to know who is > its owner, try this: > (file-attributes "D:/$RECYCLE.BIN/S-1-5-21-..." 'string) (t 1 "ME" "Domain Users" (20885 54199 0 0) (20885 54199 0 0) (20885 54199 0 0) 0 "drwxrwxrwx" t 0 506428215) Where ME is my user name. ME is also the value of `user-real-login-name'. In what way does this return value indicate that I do not (user ME does not) have access to the file? The doc of `file-attributes' does not hint (to me) anything about such a value indicating that the file is private. > The name of the owner will show up as the 3rd element of the list it > returns, and the name of the group (I'm guessing "None") as the 4th > element. (Unless file-attributes also signals an error.) So I am apparently the owner, and the group is Domain Users, to which I belong. Where do we see indicated the fact that I do not have real access to the file? > > I see. What would you suggest, in that case, for filtering out > > such directories, so the error is not raised? > > > > I can wrap the call in `ignore-errors' or equivalent, I suppose. > > But at that point it might be too late (depending on the context). >=20 > Catching and ignoring errors is the only way, I think. >=20 > > And given this "inconsistency", don't you think this gotcha should > > be mentioned in the doc - of `file-accessible-directory-p', for > > example? >=20 > Maybe. I'll have to think of a useful way of describing this. Perhaps what you said above, if nothing more informative can be found: On Windows, that test is not reliable enough. > > That predicate would seem to be unusable as a general test for > > access to a directory. IOW, what it claims it does is hardly > > what it does, apparently. >=20 > It's not unusable. It checks the read-only bit (and the executable > bit for files). Unusable "as a general test for access". And what you say is not what the doc claims. Perhaps the doc should say what you just said, and mention that that is all it tests, that it is not a general test for accessibility. Perhaps the doc should say that the predicate can give a false positive (t, when the dir is inaccessible). Can it also give a false negative (nil when the dir is accessible)? > > And perhaps we need another predicate that actually does what this > > one says it does, by trying to access the directory? >=20 > It would be too expensive to be useful, I think. Just trying to > read it, like you did, is good enough. >=20 > > BTW, the doc string of `file-accessible-p' says nothing about what > > it returns if file FILENAME does NOT name a directory you can > > open. >=20 > Anything but t means it's not accessible. I think this much is > clear from the doc string. That is clear to you, but it is not clear from the doc string, IMHO. It would be clear if it said it. ;-) From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 26 11:47:04 2015 Received: (at 21346) by debbugs.gnu.org; 26 Aug 2015 15:47:04 +0000 Received: from localhost ([127.0.0.1]:38954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUcul-0007b2-UP for submit@debbugs.gnu.org; Wed, 26 Aug 2015 11:47:04 -0400 Received: from mtaout29.012.net.il ([80.179.55.185]:33877) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUcuj-0007aX-1D for 21346@debbugs.gnu.org; Wed, 26 Aug 2015 11:47:02 -0400 Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0NTP00D0053O0800@mtaout29.012.net.il> for 21346@debbugs.gnu.org; Wed, 26 Aug 2015 18:47:09 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTP00BEV56L0B20@mtaout29.012.net.il>; Wed, 26 Aug 2015 18:47:09 +0300 (IDT) Date: Wed, 26 Aug 2015 18:46:58 +0300 From: Eli Zaretskii Subject: Re: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' In-reply-to: X-012-Sender: halo1@inter.net.il To: Drew Adams Message-id: <83lhcy59xp.fsf@gnu.org> References: <2974d023-5059-414f-960d-273fbeaca5de@default> <83fv37fdcg.fsf@gnu.org> <83egirfane.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Tue, 25 Aug 2015 13:55:13 -0700 (PDT) > From: Drew Adams > Cc: 21346@debbugs.gnu.org > > > That's not what I wanted to see there. If you want to know who is > > its owner, try this: > > (file-attributes "D:/$RECYCLE.BIN/S-1-5-21-..." 'string) > > (t 1 "ME" "Domain Users" > (20885 54199 0 0) > (20885 54199 0 0) > (20885 54199 0 0) > 0 "drwxrwxrwx" t 0 506428215) > > Where ME is my user name. ME is also the value of `user-real-login-name'. > In what way does this return value indicate that I do not (user ME does > not) have access to the file? It doesn't. Which is why I asked for the output of file-extended-attributes. > The doc of `file-attributes' does not hint (to me) anything about > such a value indicating that the file is private. If the mode bits were "drwx------", then it'd be private. But this cannot happen on Windows, due to the way Emacs emulates the Posix mode bits. > > The name of the owner will show up as the 3rd element of the list it > > returns, and the name of the group (I'm guessing "None") as the 4th > > element. (Unless file-attributes also signals an error.) > > So I am apparently the owner, and the group is Domain Users, to which > I belong. You are the owner, but you are not given access to that directory, yes. > Where do we see indicated the fact that I do not have real access to > the file? In the output of file-extended-attributes. But that is hard to interpret by mere mortals, so type this command from the Windows shell prompt to see a human-readable description: icacls d:\$RECYCLE.BIN\S-1-5-21-3120201979-235963886-2582836866-1001 It's quite possible that the command will say "Access denied". If it does, you need to run that command from a cmd shell session started "as administrator" (e.g., by right-clicking on "command prompt" desktop shortcut or on its shortcut in the Start dialog, selecting "Run as administrator", and clicking YES on the privilege elevation dialog). Btw, if you run Emacs from cmd that was started "as administrator", the call to directory-files for that directory will most probably succeed, and show you the files in that user's recycle bin. > > > And given this "inconsistency", don't you think this gotcha should > > > be mentioned in the doc - of `file-accessible-directory-p', for > > > example? > > > > Maybe. I'll have to think of a useful way of describing this. > > Perhaps what you said above, if nothing more informative can be found: > > On Windows, that test is not reliable enough. Done. > > > That predicate would seem to be unusable as a general test for > > > access to a directory. IOW, what it claims it does is hardly > > > what it does, apparently. > > > > It's not unusable. It checks the read-only bit (and the executable > > bit for files). > > Unusable "as a general test for access". I disagree. It does test that the file exists and is a directory, so it _will_ tell you when either of these 2 conditions is false. It just can yield a false positive regarding the success of opening and reading the directory. The alternative is to complicate the heck out of the implementation, make it much slower, and get false negatives instead. I think the alternative is worse. > Can it also give a false negative (nil when the dir is accessible)? Not on Windows, AFAIK. > > > BTW, the doc string of `file-accessible-p' says nothing about what > > > it returns if file FILENAME does NOT name a directory you can > > > open. > > > > Anything but t means it's not accessible. I think this much is > > clear from the doc string. > > That is clear to you, but it is not clear from the doc string, IMHO. The doc string says "Return t if file FILENAME names a directory you can open.". Ergo, if it returns something else, FILENAME is either NOT a directory or you can NOT open it. I fail to see how this could be unclear, it's elementary logic for predicates. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 26 12:27:20 2015 Received: (at 21346) by debbugs.gnu.org; 26 Aug 2015 16:27:20 +0000 Received: from localhost ([127.0.0.1]:39010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUdXk-0001ia-0m for submit@debbugs.gnu.org; Wed, 26 Aug 2015 12:27:20 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:21334) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUdXi-0001iT-RT for 21346@debbugs.gnu.org; Wed, 26 Aug 2015 12:27:19 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7QGRHVD031203 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Aug 2015 16:27:17 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7QGRGf5028072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 26 Aug 2015 16:27:16 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7QGRGh5000316; Wed, 26 Aug 2015 16:27:16 GMT MIME-Version: 1.0 Message-ID: Date: Wed, 26 Aug 2015 09:27:15 -0700 (PDT) From: Drew Adams To: Eli Zaretskii , Drew Adams Subject: RE: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' References: <<2974d023-5059-414f-960d-273fbeaca5de@default>> <<83fv37fdcg.fsf@gnu.org>> <> <<83egirfane.fsf@gnu.org>> <> <<83lhcy59xp.fsf@gnu.org>> In-Reply-To: <<83lhcy59xp.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 21346 Cc: 21346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) > In the output of file-extended-attributes. But that is hard to > interpret by mere mortals, so type this command from the Windows > shell prompt to see a human-readable description: >=20 > icacls d:\$RECYCLE.BIN\S-1-5-21-3120201979-235963886-2582836866- > 1001 Thanks for the info. > > > > And given this "inconsistency", don't you think this gotcha > > > > should be mentioned in the doc - of `file-accessible-directory-p', > > > > for example? > > > > Perhaps what you said above, if nothing more informative can be > > found: On Windows, that test is not reliable enough. >=20 > Done. Thx. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 11:01:31 2015 Received: (at 21346-done) by debbugs.gnu.org; 31 Aug 2015 15:01:31 +0000 Received: from localhost ([127.0.0.1]:43775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWQaR-0001Zf-5w for submit@debbugs.gnu.org; Mon, 31 Aug 2015 11:01:31 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:56865) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWQaO-0001ZV-DM for 21346-done@debbugs.gnu.org; Mon, 31 Aug 2015 11:01:29 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NTY00H00BYGQS00@a-mtaout20.012.net.il> for 21346-done@debbugs.gnu.org; Mon, 31 Aug 2015 18:01:26 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTY00HRTCEEHL90@a-mtaout20.012.net.il>; Mon, 31 Aug 2015 18:01:26 +0300 (IDT) Date: Mon, 31 Aug 2015 18:01:36 +0300 From: Eli Zaretskii Subject: Re: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' In-reply-to: <83lhcy59xp.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: drew.adams@oracle.com Message-id: <838u8r1oz3.fsf@gnu.org> References: <2974d023-5059-414f-960d-273fbeaca5de@default> <83fv37fdcg.fsf@gnu.org> <83egirfane.fsf@gnu.org> <83lhcy59xp.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 21346-done Cc: 21346-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Wed, 26 Aug 2015 18:46:58 +0300 > From: Eli Zaretskii > Cc: 21346@debbugs.gnu.org > > > > > That predicate would seem to be unusable as a general test for > > > > access to a directory. IOW, what it claims it does is hardly > > > > what it does, apparently. > > > > > > It's not unusable. It checks the read-only bit (and the executable > > > bit for files). > > > > Unusable "as a general test for access". > > I disagree. It does test that the file exists and is a directory, so > it _will_ tell you when either of these 2 conditions is false. It > just can yield a false positive regarding the success of opening and > reading the directory. The alternative is to complicate the heck out > of the implementation, make it much slower, and get false negatives > instead. I think the alternative is worse. On further thought, I found a simple and surprisingly efficient method of testing directory accessibility without any false positives, and made the corresponding changes. > > > > And given this "inconsistency", don't you think this gotcha should > > > > be mentioned in the doc - of `file-accessible-directory-p', for > > > > example? > > > > > > Maybe. I'll have to think of a useful way of describing this. > > > > Perhaps what you said above, if nothing more informative can be found: > > > > On Windows, that test is not reliable enough. > > Done. I've now removed that caveat from the doc string. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 11:05:09 2015 Received: (at 21346-done) by debbugs.gnu.org; 31 Aug 2015 15:05:09 +0000 Received: from localhost ([127.0.0.1]:43781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWQdx-0001f2-5l for submit@debbugs.gnu.org; Mon, 31 Aug 2015 11:05:09 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:29269) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWQdv-0001eu-Hz for 21346-done@debbugs.gnu.org; Mon, 31 Aug 2015 11:05:08 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7VF56x4018359 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 Aug 2015 15:05:06 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7VF559c006168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 31 Aug 2015 15:05:06 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7VF55gE005325; Mon, 31 Aug 2015 15:05:05 GMT MIME-Version: 1.0 Message-ID: Date: Mon, 31 Aug 2015 08:05:04 -0700 (PDT) From: Drew Adams To: Eli Zaretskii Subject: RE: bug#21346: 25.0.50; REGRESSION: `directory-files' raises error for DIR that is `file-accessible-directory-p' References: <<2974d023-5059-414f-960d-273fbeaca5de@default>> <<83fv37fdcg.fsf@gnu.org>> <> <<83egirfane.fsf@gnu.org>> <> <<83lhcy59xp.fsf@gnu.org>> <<838u8r1oz3.fsf@gnu.org>> In-Reply-To: <<838u8r1oz3.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21346-done Cc: 21346-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > On further thought, I found a simple and surprisingly efficient method > of testing directory accessibility without any false positives, and > made the corresponding changes. Bravo! Thx. From unknown Sat Aug 16 18:47:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 29 Sep 2015 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator