From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philip Hodges Newsgroups: gmane.emacs.bugs Subject: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Date: Wed, 23 Apr 2014 22:54:18 +0200 Message-ID: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1398286656 29840 80.91.229.3 (23 Apr 2014 20:57:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2014 20:57:36 +0000 (UTC) To: 17330@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 23 22:57:28 2014 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 1Wd4ER-0007Ua-BR for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Apr 2014 22:57:27 +0200 Original-Received: from localhost ([::1]:34672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4EQ-0006uF-U4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Apr 2014 16:57:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4EE-0006u7-Lr for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:57:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wd4E4-0004DI-2Q for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:57:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4E3-0004DD-S0 for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wd4E3-0001kv-Gu for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:57:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Hodges Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Apr 2014 20:57:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17330 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13982865776673 (code B ref -1); Wed, 23 Apr 2014 20:57:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Apr 2014 20:56:17 +0000 Original-Received: from localhost ([127.0.0.1]:56532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd4DI-0001jS-SY for submit@debbugs.gnu.org; Wed, 23 Apr 2014 16:56:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51753) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd4Bv-0001gU-FL for submit@debbugs.gnu.org; Wed, 23 Apr 2014 16:54:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wd4Bk-0002y4-VZ for submit@debbugs.gnu.org; Wed, 23 Apr 2014 16:54:51 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4Bk-0002y0-S6 for submit@debbugs.gnu.org; Wed, 23 Apr 2014 16:54:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4Bb-0003q2-7B for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:54:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wd4BS-0002wH-VT for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:54:31 -0400 Original-Received: from zhbdzmsp-smta17.bluewin.ch ([195.186.99.133]:64331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd4BS-0002w7-Oq for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 16:54:22 -0400 Original-Received: from [195.186.227.131] ([195.186.227.131:51203] helo=zhhdzmsp-smta14.bluewin.ch) by zhbdzmsp-smta17.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 45/C2-15928-B7828535; Wed, 23 Apr 2014 20:54:19 +0000 Original-Received: from [192.168.0.10] (46.127.159.181) by zhhdzmsp-smta14.bluewin.ch (8.5.142) (authenticated as philip.hodges@bluewin.ch) id 52330D9E0F23F531 for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 20:54:19 +0000 X-Mailer: Apple Mail (2.1874) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Wed, 23 Apr 2014 16:56:13 -0400 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: 140.186.70.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:88264 Archived-At: [using emacs-w32.exe 24.3 in cygwin but also applies to other = platforms.] Symptom: When I try to cd to my samba-mounted directory, or try to run ediff-files, it refuses with the error "Cannot cd to my_directory_name: Permission denied" The same directory opens fine in dired-mode, and I can open files within = it. A workaround is to make my directory and its parents executable for = "others", but of course it would be much better to keep the correct mode in force. Maybe a more recent or better configured samba on the server would help. This is just one way in which file-executable-p can produce a false = negative, where executing the file or searching the directory may succeed after = all. [False positives, where the operation refuses, have no impact so long as the operation fails quickly with an equivalent but authoritative error = message.] This is typical of many situations where it is not good enough just to check quickly whether it just looks like it can or cannot be done; you have to also actually try it, and report the outcome of that particular attempt at that particular moment. A preliminary check may still be useful too if it produces a better = error message quickly up front with no dashed expectations or cleaning up to = do. The comments in fileio.c check_executable (and check_writeable) point = out that on some filesystems there might be an access control list (ACL) in = force, and that the effective user might have more permission than the real = user. Suggested fix: In files.el the function cd-absolute can ask for confirmation in case check-executable-p might be producing a false negative: ;; in emacs-24.3/lisp/files.el [cd-absolute] replace the expression (unless (file-executable-p dir) (error "Cannot cd to %s: Permission denied" dir)) ;; with (unless (file-executable-p dir) (unless (yes-or-no-p (format "Directory does not look searchable; try = to cd to %s anyway? " dir)) (error "Cannot cd to %s: Permission denied" dir))) I encountered the cd failure originally on invoking ediff-files to merge source code from a samba mount, then noticed cd itself is affected too. I haven't run into any other false negative cases. The 24.3 distribution contains about 50 calls to file-executable-p where a fix like this might potentially be useful, not to mention custom code and community packages, and other similar = functions. In directory search contexts file-searchable-p might be a better name.