From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams 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 13:55:13 -0700 (PDT) Message-ID: References: <<2974d023-5059-414f-960d-273fbeaca5de@default>> <<83fv37fdcg.fsf@gnu.org>> <> <<83egirfane.fsf@gnu.org>> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1440536185 22738 80.91.229.3 (25 Aug 2015 20:56:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2015 20:56:25 +0000 (UTC) Cc: 21346@debbugs.gnu.org To: Eli Zaretskii , Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 25 22:56:11 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 1ZULGM-000135-4h for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 22:56:10 +0200 Original-Received: from localhost ([::1]:34556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZULGK-0004Yp-Tf for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 16:56:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZULGH-0004Yg-IT for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 16:56:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZULGE-00025F-As for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 16:56:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZULGE-00025B-7L for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 16:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZULGD-00058u-T6 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 16:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2015 20:56:01 +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.144053612019712 (code B ref 21346); Tue, 25 Aug 2015 20:56:01 +0000 Original-Received: (at 21346) by debbugs.gnu.org; 25 Aug 2015 20:55:20 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 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)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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:105814 Archived-At: > > 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. ;-)