From unknown Sat Jun 21 03:20:52 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17330 <17330@debbugs.gnu.org> To: bug#17330 <17330@debbugs.gnu.org> Subject: Status: files.el cd-absolute overcome false negative from file-executable-p Reply-To: bug#17330 <17330@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:20:52 +0000 retitle 17330 files.el cd-absolute overcome false negative from file-execut= able-p reassign 17330 emacs submitter 17330 Philip Hodges severity 17330 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 23 16:56:17 2014 Received: (at submit) by debbugs.gnu.org; 23 Apr 2014 20:56:17 +0000 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 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 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 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]: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 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 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 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 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 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 From: Philip Hodges Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: files.el cd-absolute overcome false negative from file-executable-p Message-Id: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> Date: Wed, 23 Apr 2014 22:54:18 +0200 To: bug-gnu-emacs@gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit 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 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: -5.0 (-----) [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. From debbugs-submit-bounces@debbugs.gnu.org Fri May 02 20:24:10 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 00:24:10 +0000 Received: from localhost ([127.0.0.1]:48858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgNkQ-00013P-Be for submit@debbugs.gnu.org; Fri, 02 May 2014 20:24:10 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59690 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgNkM-00013B-MA for 17330@debbugs.gnu.org; Fri, 02 May 2014 20:24:07 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WgNkL-0000Ny-0d; Fri, 02 May 2014 20:24:05 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> X-Spook: Croatian digicash Legion of Doom InfoSec World Trade X-Ran: )1y1MF]apvV.l4Gw@|t"R7R[\HP1gx,]yeg2/KA%Z2$Ify4>3|k6W[iv.PK|=%O^G\j-U< X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Fri, 02 May 2014 20:24:04 -0400 In-Reply-To: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> (Philip Hodges's message of "Wed, 23 Apr 2014 22:54:18 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -5.7 (-----) Philip Hodges wrote: > [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. > 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. Perhaps there is something Cygwin-specific at work, because I don't think I can reproduce such a problem on eg RHEL 6.5 GNU/Linux. As user A: mkdir foo1 foo2 chmod 700 foo1 foo2 setfacl -m u:b:r-x foo1 As user B: In the shell: [ -x foo1 ] # -> true In Emacs 24.3: file-executable-p foo1 ; -> true (There's also file-accessible-directory-p; does that work any better for you?). From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 05:17:50 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 09:17:50 +0000 Received: from localhost ([127.0.0.1]:49103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgW4r-0001VU-Dc for submit@debbugs.gnu.org; Sat, 03 May 2014 05:17:49 -0400 Received: from zhbdzmsp-smta15.bluewin.ch ([195.186.99.132]:42339) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgW4o-0001VC-RZ for 17330@debbugs.gnu.org; Sat, 03 May 2014 05:17:47 -0400 Received: from [195.186.227.130] ([195.186.227.130:36498] helo=zhhdzmsp-smta12.bluewin.ch) by zhbdzmsp-smta15.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id CB/32-15424-434B4635; Sat, 03 May 2014 09:17:40 +0000 Received: from [192.168.0.13] (46.127.159.181) by zhhdzmsp-smta12.bluewin.ch (8.5.142) (authenticated as philip.hodges) id 52A87E3C09498DD9; Sat, 3 May 2014 09:17:40 +0000 Message-ID: <5364B437.2070106@bluewin.ch> Date: Sat, 03 May 2014 11:17:43 +0200 From: Philip Hodges User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Glenn Morris Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -1.4 (-) On 2014-05-03 02:24, Glenn Morris wrote: > Philip Hodges wrote: > >> [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. > >> 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. > > > Perhaps there is something Cygwin-specific at work, because I don't > think I can reproduce such a problem on eg RHEL 6.5 GNU/Linux. > > As user A: > mkdir foo1 foo2 > chmod 700 foo1 foo2 > setfacl -m u:b:r-x foo1 > > As user B: > In the shell: [ -x foo1 ] # -> true > > In Emacs 24.3: file-executable-p foo1 ; -> true > > > (There's also file-accessible-directory-p; does that work any better for > you?). > Your example platform likely has euidaccess and so takes the effective user id and ACL into account. Thanks for checking. I'm glad it works. Otherwise fileio.c:check_executable calls access which ignores any effective id, or looks at bits returned by stat. Calling something like GetFileAttributes might give a truer picture, but apparently there are several different ways the id(s) a user has can be permitted to access files in a directory, so interpreting the results might not be easy. Would simply opening the directory, or starting a directory entries listing, be more reliable, or too slow? In the end what counts is whether listing the directory at a particular moment actually works. To concoct a hopefully absurd example, the directory might be on a filesystem that has been cracked to grant directory listing access to guest users during NSA overnight batch job hours. There is no way a security audit system calling check_executable on an arbitrary client system can possibly discover that. Samba can be configured to allow or deny various kinds of access to various users, and to map the permission bits in artificial ways. The host access and client access permissions actually applied can differ wildly from what stat returns. I dare say the configuration of my samba share can be improved, but I think there will still be valid use cases as well as misconfigurations where false negatives cannot be completely ruled out. I'm happy that ediff-directories works for my samba folder when I tell it to let me override the outcome of check_executable and cd to it anyway. If I do cd to a directory that is genuinely not searchable, which I think would be something I could always avoid, the question actually helps me think about how I got there and whether it really is correct that I don't seem to have access. It's not the whole story. There are still circumstances where I get a slightly different error message about no permission to set current directory, after callproc.c:call-process or proc.c:start-process calls file-accessible-directory-p. It is C code calling C code, I don't suppose it can be intercepted in Lisp? A process does not necessarily even always have or need a current directory (for example MacOS before MacOSX). It might not even use relative filenames that need prefixing at all. Why does a directory even have to exist to use it to expand a relative pathname? Is Macavity's parent ever there? (That cat is free as in spirit, not as in beer). Do all GNU/Linux processes inevitably open the current directory for read? Does Windows open it and keep a handle, does it fail if it cannot? I will have to experiment and find out. The function file-accessible-directory-p is more appropriately named for this context but it is not better. It just checks for a directory first before calling file-executable-p and hence check_executable. From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 05:35:47 2014 Received: (at submit) by debbugs.gnu.org; 3 May 2014 09:35:47 +0000 Received: from localhost ([127.0.0.1]:49122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgWME-00024S-PU for submit@debbugs.gnu.org; Sat, 03 May 2014 05:35:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43460) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgWMC-00024A-3p for submit@debbugs.gnu.org; Sat, 03 May 2014 05:35:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgWM0-0005dq-Rp for submit@debbugs.gnu.org; Sat, 03 May 2014 05:35:38 -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]:47200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgWM0-0005dm-PR for submit@debbugs.gnu.org; Sat, 03 May 2014 05:35:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgWLv-0005zR-Aa for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 05:35:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgWLp-0005b3-LZ for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 05:35:27 -0400 Received: from plane.gmane.org ([80.91.229.3]:33105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgWLp-0005at-EU for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 05:35:21 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WgWLm-0005Cb-7T for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 11:35:18 +0200 Received: from pd9eb04be.dip0.t-ipconnect.de ([217.235.4.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 May 2014 11:35:18 +0200 Received: from Stromeko by pd9eb04be.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 May 2014 11:35:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Achim Gratz Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Date: Sat, 03 May 2014 11:35:01 +0200 Organization: Linux Private Site Lines: 23 Message-ID: <87d2fvjjcq.fsf@Rainer.invalid> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pd9eb04be.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:HGctHktMOXQcqSn9qZb+i4aYBbI= 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) 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.1 (----) Philip Hodges writes: > Your example platform likely has euidaccess and so takes the effective > user id and ACL into account. Thanks for checking. I'm glad it works. > > Otherwise fileio.c:check_executable calls access which ignores any > effective id, or looks at bits returned by stat. Cygwin also uses euidaccess (or should, anyway): http://cygwin.com/ml/cygwin/2011-12/msg00364.html But yes, you can totally have full access to a directory or file on a Windows box while all permission flags show that you don't (I guess that is also possible on UN*X, although I've never tried). You'll never know until you actually try. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Q+, Q and microQ: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 09:26:21 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 13:26:21 +0000 Received: from localhost ([127.0.0.1]:49195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgZxM-0000qp-8B for submit@debbugs.gnu.org; Sat, 03 May 2014 09:26:20 -0400 Received: from mtaout29.012.net.il ([80.179.55.185]:56944) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgZxI-0000qV-AV for 17330@debbugs.gnu.org; Sat, 03 May 2014 09:26:18 -0400 Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0N5000G001QNLQ00@mtaout29.012.net.il> for 17330@debbugs.gnu.org; Sat, 03 May 2014 16:27:23 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N50009PB2PMO690@mtaout29.012.net.il>; Sat, 03 May 2014 16:27:23 +0300 (IDT) Date: Sat, 03 May 2014 16:26:28 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <87d2fvjjcq.fsf@Rainer.invalid> X-012-Sender: halo1@inter.net.il To: Achim Gratz Message-id: <8338gr0z97.fsf@gnu.org> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> <87d2fvjjcq.fsf@Rainer.invalid> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: 17330@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 (+) > From: Achim Gratz > Date: Sat, 03 May 2014 11:35:01 +0200 > > But yes, you can totally have full access to a directory or file on a > Windows box while all permission flags show that you don't (I guess that > is also possible on UN*X, although I've never tried). You'll never know > until you actually try. That's true (on Windows; I don't think it's possible on Unix), but why is that an Emacs problem? I think this problem should be communicated to the Cygwin maintainers: an accessible directory should return success from the faccessat call, because otherwise Posix-originated programs such as Emacs will misbehave. If the Cygwin maintainers will decide that this specific situation (whose particulars as far as Windows ACL data of the directory in question was never shown by the OP, by the way), then this would mean it's either a cockpit error (i.e. the user shoot himself in the foot by creating a security descriptor he shouldn't have), or that Cygwin does not intend to support such situations in the first place. Either way, Emacs is not to blame here. From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 09:40:34 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 13:40:34 +0000 Received: from localhost ([127.0.0.1]:49212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgaB6-0001Fv-VB for submit@debbugs.gnu.org; Sat, 03 May 2014 09:40:33 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:56463) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgaB3-0001Fa-An for 17330@debbugs.gnu.org; Sat, 03 May 2014 09:40:30 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0N50008002SPF500@a-mtaout23.012.net.il> for 17330@debbugs.gnu.org; Sat, 03 May 2014 16:40:22 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N50008JN3BAA780@a-mtaout23.012.net.il>; Sat, 03 May 2014 16:40:22 +0300 (IDT) Date: Sat, 03 May 2014 16:40:40 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <5364B437.2070106@bluewin.ch> X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <831twb0ylj.fsf@gnu.org> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: Sat, 03 May 2014 11:17:43 +0200 > From: Philip Hodges > Cc: 17330@debbugs.gnu.org > > Your example platform likely has euidaccess and so takes the effective > user id and ACL into account. Thanks for checking. I'm glad it works. > > Otherwise fileio.c:check_executable calls access which ignores any > effective id, or looks at bits returned by stat. As Achim correctly points out, this doesn't matter, because on Windows a directory can be accessible to you by virtue of your belonging to certain user groups (like Power Users etc.), even though all the ACEs in that directory's security descriptor deny you any access. > Calling something like GetFileAttributes might give a truer picture No, it won't: GetFileAttributes does not return any access rights, only the file's attributes. IOW, it could tell that the file is a directory, but not if the directory is accessible to this or that user. > Would simply opening the directory, or starting a directory entries > listing, be more reliable, or too slow? If you try cd'ing, you might be unable to distinguish between an existing file that is not a directory and an inaccessible directory. Not sure if that is important here, I didn't analyze the users of cd-absolute. (Opening a directory is non-portable, and furthemore will not necessarily tell you that it can be listed -- these are different privileges on Windows.) > Samba can be configured to allow or deny various kinds of access to > various users, and to map the permission bits in artificial ways. The > host access and client access permissions actually applied can differ > wildly from what stat returns. I dare say the configuration of my samba > share can be improved, but I think there will still be valid use cases > as well as misconfigurations where false negatives cannot be completely > ruled out. Why not ask Cygwin maintainers to cover these situations in their euidaccess and/or faccessat implementations? Why should Emacs solve this for you, when it works on any other Posix platforms (and on some non-Posix ones)? Unlike the native Windows port of Emacs, the Cygwin build relies on a free library whose sources are freely available and can be fixed if a bug there is found and reported. So that's what I suggest to do -- report this to the Cygwin maintainers, and ask them to fix this. > It's not the whole story. There are still circumstances where I get a > slightly different error message about no permission to set current > directory, after callproc.c:call-process or proc.c:start-process calls > file-accessible-directory-p. It is C code calling C code, I don't > suppose it can be intercepted in Lisp? You will have endless such problems if accessible directories don't pass the test by euidaccess or access. This _must_ be fixed in the Cygwin library, or by your changing the permissions of those directories so that they are reported as executables. > A process does not necessarily even always have or need a current > directory (for example MacOS before MacOSX). It does in Emacs, because Emacs frequently (if not always) invokes programs in the context of an Emacs buffer, which conceptually (from the user POV) means the program should run in that buffer's directory. > Why does a directory even have to exist to use it to expand a > relative pathname? It doesn't: (expand-file-name "../doesntexist/anotherfake/foobar") => "d:/gnu/bzr/emacs/doesntexist/anotherfake/foobar" From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 09:58:48 2014 Received: (at submit) by debbugs.gnu.org; 3 May 2014 13:58:48 +0000 Received: from localhost ([127.0.0.1]:49830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgaSl-0001vE-Gi for submit@debbugs.gnu.org; Sat, 03 May 2014 09:58:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45155) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgaSj-0001ux-20 for submit@debbugs.gnu.org; Sat, 03 May 2014 09:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgaSW-0003W3-Bz for submit@debbugs.gnu.org; Sat, 03 May 2014 09:58:39 -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]:36673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgaSW-0003Vz-9H for submit@debbugs.gnu.org; Sat, 03 May 2014 09:58:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgaSP-0000O0-WD for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 09:58:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgaSJ-0003TU-O5 for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 09:58:25 -0400 Received: from plane.gmane.org ([80.91.229.3]:60554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgaSJ-0003TO-HH for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 09:58:19 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WgaSH-00052r-3M for bug-gnu-emacs@gnu.org; Sat, 03 May 2014 15:58:17 +0200 Received: from pd9eb1613.dip0.t-ipconnect.de ([217.235.22.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 May 2014 15:58:17 +0200 Received: from Stromeko by pd9eb1613.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 May 2014 15:58:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Achim Gratz Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Date: Sat, 03 May 2014 15:58:05 +0200 Organization: Linux Private Site Lines: 24 Message-ID: <878uqjj76a.fsf@Rainer.invalid> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> <87d2fvjjcq.fsf@Rainer.invalid> <8338gr0z97.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pd9eb1613.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:HiADHwUkIJEHDPCsi+vO/MTCP54= 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) 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.1 (----) Eli Zaretskii writes: > If the Cygwin maintainers will decide that this specific situation > (whose particulars as far as Windows ACL data of the directory in > question was never shown by the OP, by the way), then this would mean > it's either a cockpit error (i.e. the user shoot himself in the foot > by creating a security descriptor he shouldn't have), or that Cygwin > does not intend to support such situations in the first place. Cygwin already has the "noacl" mount option which fakes the uid/gid and permissions for that file system so that they always look sane from the POSIX perspective and then you'll find out when you access the file whether you have access. While it's generally a sign of some problematic configuration someplace else and introducing some other problems when you have to use it, the OP could maybe tell us if that makes a difference to the reported problem. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptations for KORG EX-800 and Poly-800MkII V0.9: http://Synth.Stromeko.net/Downloads.html#KorgSDada From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 12:37:28 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 16:37:28 +0000 Received: from localhost ([127.0.0.1]:49890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgcwK-0006PP-Cq for submit@debbugs.gnu.org; Sat, 03 May 2014 12:37:28 -0400 Received: from mtaout29.012.net.il ([80.179.55.185]:54265) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgcwH-0006P4-6P for 17330@debbugs.gnu.org; Sat, 03 May 2014 12:37:26 -0400 Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0N5000100B9PX300@mtaout29.012.net.il> for 17330@debbugs.gnu.org; Sat, 03 May 2014 19:38:31 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5000IRMBK76K80@mtaout29.012.net.il>; Sat, 03 May 2014 19:38:31 +0300 (IDT) Date: Sat, 03 May 2014 19:37:18 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <878uqjj76a.fsf@Rainer.invalid> X-012-Sender: halo1@inter.net.il To: Achim Gratz Message-id: <83zjiyzum9.fsf@gnu.org> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> <87d2fvjjcq.fsf@Rainer.invalid> <8338gr0z97.fsf@gnu.org> <878uqjj76a.fsf@Rainer.invalid> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: 17330@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 (+) > From: Achim Gratz > Date: Sat, 03 May 2014 15:58:05 +0200 > > Eli Zaretskii writes: > > If the Cygwin maintainers will decide that this specific situation > > (whose particulars as far as Windows ACL data of the directory in > > question was never shown by the OP, by the way), then this would mean > > it's either a cockpit error (i.e. the user shoot himself in the foot > > by creating a security descriptor he shouldn't have), or that Cygwin > > does not intend to support such situations in the first place. > > Cygwin already has the "noacl" mount option which fakes the uid/gid and > permissions for that file system so that they always look sane from the > POSIX perspective and then you'll find out when you access the file > whether you have access. Yes, I know. But it's not clear to me at this point that the only reasonable way out of this is by using "noacl". > While it's generally a sign of some problematic configuration > someplace else and introducing some other problems when you have to > use it, the OP could maybe tell us if that makes a difference to the > reported problem. Indeed, having more details about the ACLs of the offending directories would be good. From debbugs-submit-bounces@debbugs.gnu.org Sat May 03 18:43:37 2014 Received: (at 17330) by debbugs.gnu.org; 3 May 2014 22:43:37 +0000 Received: from localhost ([127.0.0.1]:50139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgiee-0000FY-RY for submit@debbugs.gnu.org; Sat, 03 May 2014 18:43:37 -0400 Received: from zhhdzmsp-smta16.bluewin.ch ([195.186.227.132]:37198) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgieb-0000FI-H6 for 17330@debbugs.gnu.org; Sat, 03 May 2014 18:43:34 -0400 Received: from [195.186.99.130] ([195.186.99.130:56979] helo=zhbdzmsp-smta11.bluewin.ch) by zhhdzmsp-smta16.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 14/87-13081-E0175635; Sat, 03 May 2014 22:43:26 +0000 Received: from [192.168.0.10] (46.127.159.181) by zhbdzmsp-smta11.bluewin.ch (8.5.142) (authenticated as philip.hodges@bluewin.ch) id 51E5C44E15F96A1F for 17330@debbugs.gnu.org; Sat, 3 May 2014 22:43:26 +0000 From: Philip Hodges Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: thanks for the comments Message-Id: Date: Sun, 4 May 2014 00:43:25 +0200 To: 17330@debbugs.gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) X-Mailer: Apple Mail (2.1874) X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 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: -1.4 (-) thanks for all the discussion contributions. I'm really happy about having my own personal same day lisp fix working = for me to stop cd-absolute believing the false negative from the = check_executable function. My best hope for the remaining subprocess cwd = cases is to look at the samba configuration and see if I can get it = improved, and maybe add a user to the cygwin passwd file. Anything involving a rebuild and new release will take months before it = is available for me to use where I need it. For completeness, and in the spirit of DRY, whatever uses start-process = and call-process *could* be refactored to share the same code to offer = the same override as file-executable-p in the same situation. And while = we are about it, can we please not ask if a file is executable when we = really just want to know if it is a searchable directory suitable for = cd. I don't see how we can ever completely rule out false negatives, unless = we are prepared to change check_executable to actually try to use the = directory (cd to it, open it, list its entries, return t, whatever). = Even the euidaccess man page warns against using it: "Generally, it is = safer just to attempt the desired operation and handle any permission = error that occurs". But I do accept that there may well be no consensus = to follow through with more reliable or less gullible code. If it is = just a few legacy platforms that lack euidaccess and fall back to = checking the wrong uid with access, then never mind. If we can prove = that the native and cygwin builds behave differently, then the offending = library function can probably be fixed long before emacs can work around = it. Thank you for pushing that suggestion. My samba share is also afflicted with false negative writeable checks, = as described here two years ago: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D10257 I connect to the samba filesystem directly in Windows as a user without = local administrator rights. I'll let you know if mounting it from cygwin = with special acl options confers more appropriate access permissions or = even works at all.= From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 00:16:23 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 04:16:23 +0000 Received: from localhost ([127.0.0.1]:50291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgnqg-0002E4-A3 for submit@debbugs.gnu.org; Sun, 04 May 2014 00:16:22 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:53279 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgnqe-0002Ds-49 for 17330@debbugs.gnu.org; Sun, 04 May 2014 00:16:20 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Wgnqb-0000i4-K6; Sun, 04 May 2014 00:16:17 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> X-Spook: asset IRA Belknap Ceridian digicash ASLET Ft. Meade X-Ran: sTt]ioKs9p(!sC:NJGwCXIx9uPt3'AzOqd{M (Philip Hodges's message of "Sat, 03 May 2014 11:17:43 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -5.7 (-----) I'm finding this rather abstract. I think a reproducible example of the same kind of issue on a Unix platform would be helpful. From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 09:01:22 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 13:01:22 +0000 Received: from localhost ([127.0.0.1]:50392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgw2i-00028v-Ua for submit@debbugs.gnu.org; Sun, 04 May 2014 09:01:21 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:48870) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgw2g-00028T-73 for 17330@debbugs.gnu.org; Sun, 04 May 2014 09:01:19 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kLodWCNIZF456B4Q4BKkZgWqBcYFbIQ X-IPAS-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kLodWCNIZF456B4Q4BKkZgWqBcYFbIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="61447824" Received: from 75-119-254-24.dsl.teksavvy.com (HELO ceviche.home) ([75.119.254.24]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 May 2014 09:01:12 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 26B7D66094; Sun, 4 May 2014 09:01:12 -0400 (EDT) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Message-ID: References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> Date: Sun, 04 May 2014 09:01:12 -0400 In-Reply-To: (Glenn Morris's message of "Sun, 04 May 2014 00:16:17 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17330 Cc: Philip Hodges , 17330@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: 0.3 (/) > I'm finding this rather abstract. I think a reproducible example of > the same kind of issue on a Unix platform would be helpful. It's probably somewhere between hard and impossible to reproduce on a Unix platform. The problem is that cd-absolute wants to signal an error if the directory specified can't be used, whereas within Emacs any string can be used for the "current directory" (it's just that some choices lead to errors later on, such as when trying to get to a relative-named file or when trying to spawn a process). AFAIK, the only moment where Emacs cares whether the OS can use something as a current directory (i.e. when it does "chdir") is when it spawn a process via call-process or start-process. So, we could solve this problem either by dropping this error, or by using call-process instead of file-executable-p. Yet another way would be to provide a new subroutine that gives access to chdir somehow (e.g. "file-chdirable-p"). I think the simplest solution for now is to turn the error into a warning. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 09:24:44 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 13:24:44 +0000 Received: from localhost ([127.0.0.1]:50398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgwPL-0002ll-TM for submit@debbugs.gnu.org; Sun, 04 May 2014 09:24:44 -0400 Received: from zhbdzmsp-smta17.bluewin.ch ([195.186.99.133]:58472) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgwPJ-0002lT-JB for 17330@debbugs.gnu.org; Sun, 04 May 2014 09:24:42 -0400 Received: from [195.186.227.130] ([195.186.227.130:60590] helo=zhhdzmsp-smta12.bluewin.ch) by zhbdzmsp-smta17.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 61/B7-15928-49F36635; Sun, 04 May 2014 13:24:36 +0000 Received: from [192.168.0.10] (46.127.159.181) by zhhdzmsp-smta12.bluewin.ch (8.5.142) (authenticated as philip.hodges@bluewin.ch) id 52A87E3C09617A9D for 17330@debbugs.gnu.org; Sun, 4 May 2014 13:24:36 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: files.el cd-absolute overcome false negative from file-executable-p From: Philip Hodges In-Reply-To: Date: Sun, 4 May 2014 15:24:35 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: 17330@debbugs.gnu.org X-Mailer: Apple Mail (2.1874) X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 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: -1.4 (-) I came across a post that confirms my suspicions that: - the _stat st_mode bits really cannot be trusted to give a meaningful = answer, no matter whether it comes from Windows or cygwin. - it is not worth calling GetFileSecurity (which is what I meant by = "something like GetFileAttributes" *) and trying to reproduce the = interpretation of the ACL information - the best way is to find out if searching a directory will succeed = really is to actually try it = http://stackoverflow.com/questions/3449465/find-the-permissions-of-a-file-= in-windows > ... somewhere between hard and impossible to reproduce ... To reproduce on any platform, simply change check_executable to *always* = return false. The easiest way to test what happens with false negatives = is to have negatives all the time. The more I read about it and think about it, the more I stand by my = original change suggestion: tell the user that the directory might not = be searchable, ask them if they want to go ahead and try it anyway. And = also ask if they always want to do that, in case the question appears so = often that it becomes annoying. I think we have to accept and work with = what we have got instead of punishing users until such time as every = possible combination of filesystem and library methods can be upgraded = in a way that might not even be practical for many of them. Surely the worst that can happen is that it becomes easier to end up = with a buffer whose current directory really is not searchable, or file = changes that cannot be saved in the original location. Good to avoid, = but not vital. Rather that than being completely denied the use of a = feature such as ediff-directories that would actually work. Much of what was written for #10257 (writeable) applies to this #17330 = (searchable directory) and vice versa. So if we are only comfortable = with just treating a -1 uid or gid specially here too, well it is not a = general solution, but better than no change at all. Having just the = default entries in the passwd file hasn't been causing me any other = noticeable trouble. [*) If I have mixed up any other detail such as which conditional = compiling macros are defined to choose between euidaccess and stat or = _stat in which builds, or misreported something observed on a system = that is not in front of me at that moment, please forgive me.]= From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 12:18:45 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 16:18:45 +0000 Received: from localhost ([127.0.0.1]:50919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgz7j-0007Sy-RB for submit@debbugs.gnu.org; Sun, 04 May 2014 12:18:44 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:63343) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wgz7g-0007Sh-Jc for 17330@debbugs.gnu.org; Sun, 04 May 2014 12:18:42 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N520040051HPR00@a-mtaout22.012.net.il> for 17330@debbugs.gnu.org; Sun, 04 May 2014 19:18:34 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N52004MS5AWFB60@a-mtaout22.012.net.il>; Sun, 04 May 2014 19:18:32 +0300 (IDT) Date: Sun, 04 May 2014 19:18:35 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83siopzfdw.fsf@gnu.org> References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, philip.hodges@bluewin.ch, 17330@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 (+) > From: Stefan Monnier > Date: Sun, 04 May 2014 09:01:12 -0400 > Cc: Philip Hodges , 17330@debbugs.gnu.org > > So, we could solve this problem either by dropping this error, or by > using call-process instead of file-executable-p. Which program would you invoke for this? From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 12:24:47 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 16:24:47 +0000 Received: from localhost ([127.0.0.1]:50924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgzDa-0007cb-Ht for submit@debbugs.gnu.org; Sun, 04 May 2014 12:24:46 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:64427) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WgzDX-0007cL-6B for 17330@debbugs.gnu.org; Sun, 04 May 2014 12:24:44 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N52004005EGTK00@a-mtaout22.012.net.il> for 17330@debbugs.gnu.org; Sun, 04 May 2014 19:24:37 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N520042R5L0FB80@a-mtaout22.012.net.il>; Sun, 04 May 2014 19:24:37 +0300 (IDT) Date: Sun, 04 May 2014 19:24:39 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <83r449zf3s.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: 17330@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 (+) > From: Philip Hodges > Date: Sun, 4 May 2014 15:24:35 +0200 > > I came across a post that confirms my suspicions that: > - the _stat st_mode bits really cannot be trusted to give a meaningful answer, no matter whether it comes from Windows or cygwin. > - it is not worth calling GetFileSecurity (which is what I meant by "something like GetFileAttributes" *) and trying to reproduce the interpretation of the ACL information > - the best way is to find out if searching a directory will succeed really is to actually try it > > http://stackoverflow.com/questions/3449465/find-the-permissions-of-a-file-in-windows You still didn't provide any details about your particular situation which triggers this problem. Would you _please_ do that? If is very hard to conduct a meaningful discussion without a clear understanding of the problem. Maybe you are right in your analysis, but without actually seeing the ACLs of the related directories, we cannot be sure that your analysis is correct and complete. Given the details, we could reason about the problem and maybe consult with some experts if the knowledge we have here is insufficient. That would make this discussion much more productive, and a satisfactory solution will probably be found quickly enough. Thanks in advance. From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 14:07:55 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 18:07:55 +0000 Received: from localhost ([127.0.0.1]:50949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wh0pO-0001si-Js for submit@debbugs.gnu.org; Sun, 04 May 2014 14:07:54 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:34055 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wh0pM-0001sY-BG for 17330@debbugs.gnu.org; Sun, 04 May 2014 14:07:52 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Wh0pK-0002ri-Id; Sun, 04 May 2014 14:07:50 -0400 From: Glenn Morris To: Stefan Monnier Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> X-Spook: encryption LABLINK bullion ASLET CDC ANC red noise UFO X-Ran: 1,GPH7&;+7*WH~G*~+g0"^skEI:gO#_OB&6;[>sO-hz*7A8VKcqwx~A'Ht@m+N!|a.`#=H X-Hue: white X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sun, 04 May 2014 14:07:50 -0400 In-Reply-To: (Stefan Monnier's message of "Sun, 04 May 2014 09:01:12 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: Philip Hodges , 17330@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: -5.7 (-----) Stefan Monnier wrote: > So, we could solve this problem either by dropping this error, or by > using call-process instead of file-executable-p. Yet another way would > be to provide a new subroutine that gives access to chdir somehow > (e.g. "file-chdirable-p"). I'd still like to hear if file-accessible-directory-p does any better than file-executable-p. At least on !DOS_NT, it seems to be something a bit different. > I think the simplest solution for now is to turn the error into a warning. Sounds good, but might be annoying on Unix platforms; if as you say this situation is impossible there an error might be clearer for them. From debbugs-submit-bounces@debbugs.gnu.org Sun May 04 18:44:56 2014 Received: (at 17330) by debbugs.gnu.org; 4 May 2014 22:44:56 +0000 Received: from localhost ([127.0.0.1]:51056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wh59U-0001Ip-7X for submit@debbugs.gnu.org; Sun, 04 May 2014 18:44:56 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:58231) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wh59R-0001IZ-KS for 17330@debbugs.gnu.org; Sun, 04 May 2014 18:44:54 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kLodWCNIZF456B4Q4BKkZgWqBcYFbIQ X-IPAS-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kLodWCNIZF456B4Q4BKkZgWqBcYFbIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="61481909" Received: from 75-119-254-24.dsl.teksavvy.com (HELO ceviche.home) ([75.119.254.24]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 May 2014 18:44:46 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 112E466094; Sun, 4 May 2014 18:44:46 -0400 (EDT) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Message-ID: References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> Date: Sun, 04 May 2014 18:44:46 -0400 In-Reply-To: (Glenn Morris's message of "Sun, 04 May 2014 14:07:50 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17330 Cc: Philip Hodges , 17330@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: 0.3 (/) > I'd still like to hear if file-accessible-directory-p does any better > than file-executable-p. At least on !DOS_NT, it seems to be something a > bit different. Indeed file-accessible-directory-p would probably be better than file-executable-p. Whether it's sufficiently better to keep the error, I don't know. >> I think the simplest solution for now is to turn the error into a warning. > Sounds good, but might be annoying on Unix platforms; if as you say > this situation is impossible there an error might be clearer for them. Agreed. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 05 18:43:42 2014 Received: (at 17330) by debbugs.gnu.org; 5 May 2014 22:43:42 +0000 Received: from localhost ([127.0.0.1]:52034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhRbp-0004gt-9Z for submit@debbugs.gnu.org; Mon, 05 May 2014 18:43:42 -0400 Received: from zhhdzmsp-smta16.bluewin.ch ([195.186.227.132]:56240) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhRbl-0004gb-E2 for 17330@debbugs.gnu.org; Mon, 05 May 2014 18:43:38 -0400 Received: from [195.186.99.131] ([195.186.99.131:41788] helo=zhbdzmsp-smta13.bluewin.ch) by zhhdzmsp-smta16.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 3A/EF-13081-01418635; Mon, 05 May 2014 22:43:30 +0000 Received: from [192.168.0.10] (46.127.159.181) by zhbdzmsp-smta13.bluewin.ch (8.5.142) (authenticated as philip.hodges@bluewin.ch) id 51DDDBBD16AD974E; Mon, 5 May 2014 22:43:28 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p From: Philip Hodges In-Reply-To: <83r449zf3s.fsf@gnu.org> Date: Tue, 6 May 2014 00:43:27 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> References: <83r449zf3s.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.1874) X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -1.4 (-) After discovering that even C functions can be redefined, today I = "activated an advice" so that all file-executable-p C code calls from = Lisp return t. No unexpected refusals, no noticeable downsides, no waiting months for C = code changes to appear in a new official release. The solution is = satisfactory in practice. So far as I am concerned, the case can be = closed. Can we at least document the unreliability first though? =46rom the cygwin FAQ: "When working out the Unix-style attribute bits = on a file, the library has to fill out some information not provided by = the WIN32 API. It *guesses* ..." I understand your being curious as to exactly why cygwin cannot guess = correctly for this samba mount without going to an awful lot of trouble. = But we do already have several statements confirming that it is not = usual or practical to even try. These make sense to me. They explain and = confirm what I am seeing. The analysis does not need to be complete. It = just takes one reproducible false negative in a realistic scenario that = is not going to go away anytime soon. At least one of the platform = library functions called by file-executable-p sometimes cannot be = trusted. That's enough for me. Let's stop trusting it at all. We could soften all these file permission functions to ask the user if = they want to try anyway. Then the next person won't have to figure out = the checks are unreliable and how to override them. I'll try running = with that for the next few days. From debbugs-submit-bounces@debbugs.gnu.org Tue May 06 00:15:33 2014 Received: (at 17330) by debbugs.gnu.org; 6 May 2014 04:15:33 +0000 Received: from localhost ([127.0.0.1]:52234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhWmz-0005fe-9a for submit@debbugs.gnu.org; Tue, 06 May 2014 00:15:33 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:43369 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhWmw-0005fU-Mv for 17330@debbugs.gnu.org; Tue, 06 May 2014 00:15:31 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WhWmu-0005Ac-Vs; Tue, 06 May 2014 00:15:29 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83r449zf3s.fsf@gnu.org> <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> X-Spook: Iran investigation 64 Vauxhall Cross Belknap dictionary X-Ran: +x7]o}LKi\=NJC)O4go`tE_/W@-MetG"l&1=EFSOA"^%@4>A~g-6hW2Hw"w{!}EKfU9EH? X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Tue, 06 May 2014 00:15:28 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: Eli Zaretskii , 17330@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: -5.7 (-----) I would *still* like to hear if file-accessible-directory-p does any better than file-executable-p. The result is only interesting in an Emacs later than 24.3. Eg 24.3.90 pretest, or current trunk or emacs-24 branch. (Since we have no recipe to reproduce this problem, no-one else can say.) From debbugs-submit-bounces@debbugs.gnu.org Tue May 06 03:17:54 2014 Received: (at 17330) by debbugs.gnu.org; 6 May 2014 07:17:54 +0000 Received: from localhost ([127.0.0.1]:52307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhZdR-0002XR-Le for submit@debbugs.gnu.org; Tue, 06 May 2014 03:17:54 -0400 Received: from mtaout24.012.net.il ([80.179.55.180]:55960) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhZdO-0002X9-9X for 17330@debbugs.gnu.org; Tue, 06 May 2014 03:17:52 -0400 Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0N5500O004VBAU00@mtaout24.012.net.il> for 17330@debbugs.gnu.org; Tue, 06 May 2014 10:15:15 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5500NLW5HF6030@mtaout24.012.net.il>; Tue, 06 May 2014 10:15:15 +0300 (IDT) Date: Tue, 06 May 2014 10:17:49 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <83k39zxtnm.fsf@gnu.org> References: <83r449zf3s.fsf@gnu.org> <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: 17330@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 (+) > From: Philip Hodges > Date: Tue, 6 May 2014 00:43:27 +0200 > Cc: 17330@debbugs.gnu.org > > After discovering that even C functions can be redefined, today I "activated an advice" so that all file-executable-p C code calls from Lisp return t. > No unexpected refusals, no noticeable downsides, no waiting months for C code changes to appear in a new official release. The solution is satisfactory in practice. So far as I am concerned, the case can be closed. Can we at least document the unreliability first though? I don't know what to document, since you never disclosed the details. Good documentation should not include FUD, it should include details that are understandable and actionable by users. Writing such documentation requires a good understanding of your situation, something we don't have in this case. > From the cygwin FAQ: "When working out the Unix-style attribute bits on a file, the library has to fill out some information not provided by the WIN32 API. It *guesses* ..." That's not directly related to the case in point, AFAIK (and yes, I do know what Cygwin does to emulate Posix permissions using Windows ACLs). > I understand your being curious as to exactly why cygwin cannot guess correctly for this samba mount without going to an awful lot of trouble. But we do already have several statements confirming that it is not usual or practical to even try. These make sense to me. They explain and confirm what I am seeing. The analysis does not need to be complete. It just takes one reproducible false negative in a realistic scenario that is not going to go away anytime soon. At least one of the platform library functions called by file-executable-p sometimes cannot be trusted. That's enough for me. Let's stop trusting it at all. It is a pity that you don't tell the details. The result will be that the problem is perhaps solved for you (using a recipe that many Emacs users will not know how to reproduce), but not for others. I urge you to reconsider. After all, the amount of words we've wasted here is surely large enough to describe your issue to the required depth. From debbugs-submit-bounces@debbugs.gnu.org Tue May 06 08:46:40 2014 Received: (at 17330) by debbugs.gnu.org; 6 May 2014 12:46:40 +0000 Received: from localhost ([127.0.0.1]:52447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhelZ-0005NH-ND for submit@debbugs.gnu.org; Tue, 06 May 2014 08:46:39 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:63433) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhelV-0005Mv-S7 for 17330@debbugs.gnu.org; Tue, 06 May 2014 08:46:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IPAS-Result: ArUGAIDvNVNLd/4Y/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="61629955" Received: from 75-119-254-24.dsl.teksavvy.com (HELO pastel.home) ([75.119.254.24]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 06 May 2014 08:46:27 -0400 Received: by pastel.home (Postfix, from userid 20848) id 92914607F4; Tue, 6 May 2014 08:46:27 -0400 (EDT) From: Stefan Monnier To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p Message-ID: References: <83r449zf3s.fsf@gnu.org> <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> Date: Tue, 06 May 2014 08:46:27 -0400 In-Reply-To: <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> (Philip Hodges's message of "Tue, 6 May 2014 00:43:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17330 Cc: Eli Zaretskii , 17330@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: 0.3 (/) > After discovering that even C functions can be redefined, today I "activated > an advice" so that all file-executable-p C code calls from Lisp return t. > No unexpected refusals, no noticeable downsides, no waiting months for > C code changes to appear in a new official release. The changes being discussed are to `cd-absolute' which is an Elisp function, so no need for recompilation. E.g. if you add (defun cd-absolute (dir) "Change current directory to given absolute file name DIR." ;; Put the name into directory syntax now, ;; because otherwise expand-file-name may give some bad results. (setq dir (file-name-as-directory dir)) ;; We used to additionally call abbreviate-file-name here, for an ;; unknown reason. Problem is that most buffers are setup ;; without going through cd-absolute and don't call ;; abbreviate-file-name on their default-directory, so the few that ;; do end up using a superficially different directory. (setq dir (expand-file-name dir)) (if (not (file-directory-p dir)) (if (file-exists-p dir) (error "%s is not a directory" dir) (error "%s: no such directory" dir)) (unless (file-accessible-directory-p dir) (error "Cannot cd to %s: Permission denied" dir)) (setq default-directory dir) (setq list-buffers-directory dir))) to your .emacs, does it fix the problem for you? Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue May 06 12:57:02 2014 Received: (at 17330) by debbugs.gnu.org; 6 May 2014 16:57:02 +0000 Received: from localhost ([127.0.0.1]:53043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Whift-00040H-D3 for submit@debbugs.gnu.org; Tue, 06 May 2014 12:57:01 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58504 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Whifn-0003zu-Fi for 17330@debbugs.gnu.org; Tue, 06 May 2014 12:56:56 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Whifk-0002VT-V7; Tue, 06 May 2014 12:56:53 -0400 From: Glenn Morris To: Stefan Monnier Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83r449zf3s.fsf@gnu.org> <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> X-Spook: Mahmoud Ahmadinejad mailbomb cybercash Bellcore beanpole X-Ran: h=?po`CCk|nidb"1sx4jd*cfPhqiUK`A+i&C~qw4>hPf~\n598S('6SHG#d|zDXcX0V]2\ X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Tue, 06 May 2014 12:56:52 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 06 May 2014 08:46:27 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: Philip Hodges , 17330@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: -5.7 (-----) Stefan Monnier wrote: > to your .emacs, does it fix the problem for you? (In an Emacs later than 24.3; ie one where file-accessible-directory-p is not just file-directory-p && file-executable-p.) From debbugs-submit-bounces@debbugs.gnu.org Wed May 07 14:15:58 2014 Received: (at 17330) by debbugs.gnu.org; 7 May 2014 18:15:58 +0000 Received: from localhost ([127.0.0.1]:54769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi6Np-0003ga-RO for submit@debbugs.gnu.org; Wed, 07 May 2014 14:15:58 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:34991) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi6Nn-0003gF-7J for 17330@debbugs.gnu.org; Wed, 07 May 2014 14:15:56 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N5700100UC09C00@a-mtaout22.012.net.il> for 17330@debbugs.gnu.org; Wed, 07 May 2014 21:15:48 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N57001JYUQB7420@a-mtaout22.012.net.il>; Wed, 07 May 2014 21:15:48 +0300 (IDT) Date: Wed, 07 May 2014 21:15:58 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <83ha51wj35.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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 (+) > From: Philip Hodges > Date: Wed, 7 May 2014 00:15:51 +0200 > > It's just a very ordinary samba mount from a UNIX box to Windows. > It's not magic at all. There are no special options configured. > With umask 027 most of the folders are 750 and regular files are 640. Thanks, but this is not enough. The problem is not in the (emulated) Posix permissions, it's in the Windows ACLs. E.g., what does icacls report for that directory? > The "documentation" that I had in mind was just something like: > ... calls system functions that can conceivably produce race conditions and false negatives. In case Emacs will not let you even try to cd to the directory, or use packages like ediff that change to it or start a subprocess with it as current working directory, you can try to overcome that refusal with (defun file-executable-p (dir) "" t) or (defadvice file-executable-p ... activate ...). I prefer to solve the problem rather than ask users work around it. From debbugs-submit-bounces@debbugs.gnu.org Thu May 08 01:55:31 2014 Received: (at 17330) by debbugs.gnu.org; 8 May 2014 05:55:31 +0000 Received: from localhost ([127.0.0.1]:55043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiHIo-00072Q-14 for submit@debbugs.gnu.org; Thu, 08 May 2014 01:55:30 -0400 Received: from zhbdzmsp-smta17.bluewin.ch ([195.186.99.133]:51476) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiHIl-000723-7S for 17330@debbugs.gnu.org; Thu, 08 May 2014 01:55:28 -0400 Received: from [195.186.227.130] ([195.186.227.130:40525] helo=zhhdzmsp-smta12.bluewin.ch) by zhbdzmsp-smta17.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 71/57-15928-84C1B635; Thu, 08 May 2014 05:55:20 +0000 Received: from [192.168.0.13] (46.127.159.181) by zhhdzmsp-smta12.bluewin.ch (8.5.142) (authenticated as philip.hodges) id 52A87E3C09B5A1BC; Thu, 8 May 2014 05:55:20 +0000 Message-ID: <536B1C56.4040307@bluewin.ch> Date: Thu, 08 May 2014 07:55:34 +0200 From: Philip Hodges User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> In-Reply-To: <83ha51wj35.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: -1.4 (-) > I prefer to solve the problem rather than ask users work around it. So when can we reasonably expect a guarantee of no more false negatives for users of 24.3 without having to inspect the fileio.c and files.el and reinvent an undocumented workaround? It will be great if you really can *solve* the problem, even just for this one particular scenario. I already suggested a pathological counterexample. Other sources mentioned do indicate that it is impossible to solve it reliably in general. But perhaps it will be enough in practice. Only the positive outcome of file-executable-p is documented as "this means you can access files in that directory". The negative outcome is not explicitly documented as meaning you cannot, yet that is how callers are interpreting it. So there is clearly scope for rewriting the documentation and changing the callers' logic to match. Asking the user whether the directory is supposed to be searchable after all is not just a workaround. It may well be the only right thing to do. In this case he was the person whose umask set the file modes on the host system, and he can also inspect them on that system. fgetacl showed no acl. I will try icacls but it may well be the same. [I did take a look at fileio.c in trunk with a view to trying to build it native and in cygwin for windows. Instead of simply downloading a snapshot I ended up reading rather too much of a very long thread about whether bzr should be replaced with git, and wondering whether they aren't already coexisting as mirrors anyway. So right now I don't have much progress to report on trying out candidate preferred solutions.] From debbugs-submit-bounces@debbugs.gnu.org Thu May 08 03:09:37 2014 Received: (at 17330) by debbugs.gnu.org; 8 May 2014 07:09:37 +0000 Received: from localhost ([127.0.0.1]:55080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiISW-0000Zw-Ej for submit@debbugs.gnu.org; Thu, 08 May 2014 03:09:36 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:43956 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiIST-0000Zm-5z for 17330@debbugs.gnu.org; Thu, 08 May 2014 03:09:34 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WiISR-000753-Bq; Thu, 08 May 2014 03:09:31 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> X-Spook: Audiotel Mantis Perl-RSA United Nations Tony Blair Bin X-Ran: A4a,htf7y/iI%7Y-bNy5Q|B/6C1v$oPW>W^|vI/UsDe:JF(/$^SrVcs*3mjb22&^'jy%z6 X-Hue: black X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 08 May 2014 03:09:31 -0400 In-Reply-To: <536B1C56.4040307@bluewin.ch> (Philip Hodges's message of "Thu, 08 May 2014 07:55:34 +0200") Message-ID: <4vvbtgu4pg.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: Eli Zaretskii , 17330@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: -5.7 (-----) Look, if you are using Cygwin, just install 24.3.90 as referenced in http://permalink.gmane.org/gmane.os.cygwin/146209 If you are using native MS Windows (or whatever they call it), download 24.3.90 from eg http://sourceforge.net/projects/emacs-bin/files/releases/ . Then tell us if file-accessible-directory-p returns non-nil on this problematic directory of yours. From debbugs-submit-bounces@debbugs.gnu.org Thu May 08 12:18:12 2014 Received: (at 17330) by debbugs.gnu.org; 8 May 2014 16:18:12 +0000 Received: from localhost ([127.0.0.1]:56173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiR1P-0000Jo-6Y for submit@debbugs.gnu.org; Thu, 08 May 2014 12:18:11 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:40051) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiR1L-0000JP-MO for 17330@debbugs.gnu.org; Thu, 08 May 2014 12:18:08 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N5900E00JROYO00@a-mtaout22.012.net.il> for 17330@debbugs.gnu.org; Thu, 08 May 2014 19:18:01 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5900E2SJY0JO70@a-mtaout22.012.net.il>; Thu, 08 May 2014 19:18:01 +0300 (IDT) Date: Thu, 08 May 2014 19:18:13 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <536B1C56.4040307@bluewin.ch> X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <838uqcw8fu.fsf@gnu.org> References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: Thu, 08 May 2014 07:55:34 +0200 > From: Philip Hodges > CC: rgm@gnu.org, 17330@debbugs.gnu.org > > > I prefer to solve the problem rather than ask users work around it. > > So when can we reasonably expect a guarantee of no more false negatives > for users of 24.3 without having to inspect the fileio.c and files.el > and reinvent an undocumented workaround? Emacs 24.3 was released more than a year ago, so fixing this in that version might be possible only by some suitable change to the directory's security descriptor outside of Emacs (if such a change is possible). But we can hope to fix this in future versions of Emacs. > It will be great if you really can *solve* the problem, even just for > this one particular scenario. I already suggested a pathological > counterexample. Other sources mentioned do indicate that it is > impossible to solve it reliably in general. But perhaps it will be > enough in practice. If we understand the problem in enough detail, we might find a solution of some sort. > Only the positive outcome of file-executable-p is documented as "this > means you can access files in that directory". The negative outcome is > not explicitly documented as meaning you cannot, yet that is how callers > are interpreting it. So there is clearly scope for rewriting the > documentation and changing the callers' logic to match. That is a different, although related discussion. Arguably, if a directory is not accessible by me, Emacs had better not attempt that, even if it might succeed, and instead leave it for the user to fix the access rights by other means. But even if we accept your views on this, it is better to try to solve the problem than work around it. From debbugs-submit-bounces@debbugs.gnu.org Fri May 09 02:54:26 2014 Received: (at 17330) by debbugs.gnu.org; 9 May 2014 06:54:26 +0000 Received: from localhost ([127.0.0.1]:56517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiehN-0003sE-8c for submit@debbugs.gnu.org; Fri, 09 May 2014 02:54:25 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:41023 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiehK-0003s4-Va for 17330@debbugs.gnu.org; Fri, 09 May 2014 02:54:23 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WiehK-0006Iq-E0; Fri, 09 May 2014 02:54:22 -0400 From: Glenn Morris To: 17330@debbugs.gnu.org Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <41559D99-B080-4B34-B491-3A811FA9FEAE@bluewin.ch> <5364B437.2070106@bluewin.ch> X-Spook: Afghanistan North Korea Ansar al-Islam Majic Saudi Arabia X-Ran: _U]r38qvNF:<4x'a-M0Utz(1;;@w5V_#PUq#yNpY6`K+J|xuP*X*+U7($#A0mu-38~HCaN X-Hue: white X-Debbugs-No-Ack: yes X-Attribution: GM Date: Fri, 09 May 2014 02:54:22 -0400 In-Reply-To: (Stefan Monnier's message of "Sun, 04 May 2014 18:44:46 -0400") Message-ID: <7c4n0zsaqp.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 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: -5.7 (-----) >> I'd still like to hear if file-accessible-directory-p does any better >> than file-executable-p. I got tired of asking, so I simply changed it to use the former anyway, since it can't be any worse than the latter and might be better. From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 06:46:41 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 10:46:41 +0000 Received: from localhost ([127.0.0.1]:58802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjRHE-0004df-4P for submit@debbugs.gnu.org; Sun, 11 May 2014 06:46:40 -0400 Received: from zhbdzmsp-smta15.bluewin.ch ([195.186.99.132]:59488) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjRHA-0004dK-Km for 17330@debbugs.gnu.org; Sun, 11 May 2014 06:46:37 -0400 Received: from [195.186.227.131] ([195.186.227.131:63443] helo=zhhdzmsp-smta14.bluewin.ch) by zhbdzmsp-smta15.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id CC/1C-15424-5055F635; Sun, 11 May 2014 10:46:29 +0000 Received: from [192.168.0.13] (46.127.159.181) by zhhdzmsp-smta14.bluewin.ch (8.5.142) (authenticated as philip.hodges) id 52330D9E1088A0E4; Sun, 11 May 2014 10:46:29 +0000 Message-ID: <536F5503.4040607@bluewin.ch> Date: Sun, 11 May 2014 12:46:27 +0200 From: Philip Hodges User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> In-Reply-To: <838uqcw8fu.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: -1.4 (-) So I started going through my platform collection setting up smb shares, so that I can connect to them, and open from native and cygwin builds. It's harder to provoke a false negative on more recent systems. Usually it's either no connection at all, because I misconfigured something, or the owner and group are interpreted as known, resulting in a rash of positives, a few of which may be false. Eventually I got a false negative result, sharing from Solaris 11.2. The credentials given for the network connection are for the owner of the share, who has full rwx 7 access to all these folders and files. These messages are from cygwin emacs-w32 24.3.90.1: ; ediff-directories on my 700 and 750 folders *does* work: Comparing '//192.168.0.18/myshare/smb/700/600' and '//192.168.0.18/myshare/smb/750/600' modulo 'nil' Comparing files... Done ; cd to the 700 folder does not, this is clearly a false negative: cd-absolute: Cannot cd to //192.168.0.18/myshare/smb/700/: Permission denied ; in a shell cd to the same 700 folder works fine $ cd //192.168.0.18/myshare/smb/700 $ ls 600 640 644 win $ icacls . . S-1-5-32-766:(OI)(CI)(RX,W,WDAC,WO,DC) S-1-5-32-767:(OI)(CI)(Rc,S,REA,RA) Everyone:(OI)(CI)(Rc,S,REA,RA) Successfully processed 1 files; Failed processing 0 files cygwin emacs-w32 emacs-version "24.3.90.1" (file-executable-p "//192.168.0.18/myshare/smb/700") nil Native builds do not seem to be affected: native emacs-version "24.3.1" (file-executable-p "//192.168.0.18/myshare/smb/700") t native emacs-version "24.3.90.1" (file-executable-p "//192.168.0.18/myshare/smb/700") t Here are some other unexpected messages encountered on the way in no particular order. Maybe you can eliminate or mitigate some of them. The credentials given for the network connection here are for another user in my group, which causes false positives for 600 and 700 modes, resulting in noisy messages when it fails to work after all. I would so much rather put up with messages like these from a false positive, than be prevented from using the file due to a false negative. Error reading dir-locals: (file-error "Opening input file" "not a directory" "//mini2012/smb/640/.dir-locals.el") ; 640 is a regular file, not a directory, but why dir-locals.el ? Error reading dir-locals: (file-error "Opening input file" "permission denied" "//mini2012/smb/700/.dir-locals.el") ; 700 is not group read and searchable, but why dir-locals.el ? Error: (file-error "Searching for program" "no such file or directory" "bzr") ; why does emacs think I want to use bzr with this file? Falling back on "slow" status detection ((file-error "Opening input file" "not a directory" "//mini2012/smb/640/.bzr/checkout/dirstate")) File exists, but cannot be read insert-directory: Listing directory failed but `access-file' worked ; which means? find-file-noselect-1: Wrong type argument: arrayp, nil I'm having a hard time understanding why you want to put so much faith in functions that are not reliable now, and will be quite hard or even genuinely impossible to make reliable in all of quite a large number of more or less realistic test scenarios. ; What is so wrong with: (if (guess-this-will-work-p) (if (try-it-did-it-work-p) "worked as expected, you got lucky" "so many messages, how could it possibly not work") (if (you-want-to-try-it-anyway-be-it-on-your-own-head-p) (if (try-it-did-it-work-p) "so many messages: end of world, or never mind?" "whoo hoo, worked around it, so much for your stupid guess"))) ; instead of (if (guess-this-will-work-p) (if (try-it-did-it-work-p) "worked as expected, you got lucky" "so many messages, how could it possibly not work") "I will not let you even try, even though I sometimes guess wrong"))) On 2014-05-08 18:18, Eli Zaretskii wrote: >> Date: Thu, 08 May 2014 07:55:34 +0200 >> From: Philip Hodges >> CC: rgm@gnu.org, 17330@debbugs.gnu.org >> >>> I prefer to solve the problem rather than ask users work around it. >> >> So when can we reasonably expect a guarantee of no more false negatives >> for users of 24.3 without having to inspect the fileio.c and files.el >> and reinvent an undocumented workaround? > > Emacs 24.3 was released more than a year ago, so fixing this in that > version might be possible only by some suitable change to the > directory's security descriptor outside of Emacs (if such a change is > possible). > > But we can hope to fix this in future versions of Emacs. > >> It will be great if you really can *solve* the problem, even just for >> this one particular scenario. I already suggested a pathological >> counterexample. Other sources mentioned do indicate that it is >> impossible to solve it reliably in general. But perhaps it will be >> enough in practice. > > If we understand the problem in enough detail, we might find a > solution of some sort. > >> Only the positive outcome of file-executable-p is documented as "this >> means you can access files in that directory". The negative outcome is >> not explicitly documented as meaning you cannot, yet that is how callers >> are interpreting it. So there is clearly scope for rewriting the >> documentation and changing the callers' logic to match. > > That is a different, although related discussion. Arguably, if a > directory is not accessible by me, Emacs had better not attempt that, > even if it might succeed, and instead leave it for the user to fix the > access rights by other means. > > But even if we accept your views on this, it is better to try to solve > the problem than work around it. > From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 09:55:25 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 13:55:25 +0000 Received: from localhost ([127.0.0.1]:58927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjUDs-0002vA-Jb for submit@debbugs.gnu.org; Sun, 11 May 2014 09:55:25 -0400 Received: from zhbdzmsp-smta17.bluewin.ch ([195.186.99.133]:40178) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjUDn-0002uC-Tb for 17330@debbugs.gnu.org; Sun, 11 May 2014 09:55:20 -0400 Received: from [195.186.227.131] ([195.186.227.131:51162] 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 FD/86-15928-0418F635; Sun, 11 May 2014 13:55:12 +0000 Received: from [192.168.0.13] (46.127.159.181) by zhhdzmsp-smta14.bluewin.ch (8.5.142) (authenticated as philip.hodges) id 52330D9E108AE88A; Sun, 11 May 2014 13:55:11 +0000 Message-ID: <536F813F.1080702@bluewin.ch> Date: Sun, 11 May 2014 15:55:11 +0200 From: Philip Hodges User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Glenn Morris , Stefan Monnier Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83r449zf3s.fsf@gnu.org> <92953814-A584-41C4-940A-E58514E423AB@bluewin.ch> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -1.4 (-) On 2014-05-06 18:56, Glenn Morris wrote: > Stefan Monnier wrote: > >> to your .emacs, does it fix the problem for you? > > (In an Emacs later than 24.3; ie one where file-accessible-directory-p > is not just file-directory-p && file-executable-p.) I can confirm that cd-absolute calling file-accessible-directory-p in emacs-w32 24.3.90 permits cd to a 700 folder on my Solaris 11.2 share. Is there a way to have the process functions call it without rebuilding? From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 13:01:11 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 17:01:11 +0000 Received: from localhost ([127.0.0.1]:59469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjX7e-0007zf-SD for submit@debbugs.gnu.org; Sun, 11 May 2014 13:01:11 -0400 Received: from mtaout26.012.net.il ([80.179.55.182]:57936) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjX7a-0007yy-Nj for 17330@debbugs.gnu.org; Sun, 11 May 2014 13:01:08 -0400 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0N5F00P005QK4400@mtaout26.012.net.il> for 17330@debbugs.gnu.org; Sun, 11 May 2014 19:58:06 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5F00LAC5SU0C40@mtaout26.012.net.il>; Sun, 11 May 2014 19:58:06 +0300 (IDT) Date: Sun, 11 May 2014 20:00:48 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <536F5503.4040607@bluewin.ch> X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <837g5suu67.fsf@gnu.org> References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: Sun, 11 May 2014 12:46:27 +0200 > From: Philip Hodges > CC: rgm@gnu.org, 17330@debbugs.gnu.org > > ; cd to the 700 folder does not, this is clearly a false negative: > cd-absolute: Cannot cd to //192.168.0.18/myshare/smb/700/: Permission > denied Why is that a false negative? According to this: > $ icacls . > . S-1-5-32-766:(OI)(CI)(RX,W,WDAC,WO,DC) > S-1-5-32-767:(OI)(CI)(Rc,S,REA,RA) > Everyone:(OI)(CI)(Rc,S,REA,RA) <<<<<<<<<<<<<<<<<<<< you indeed have no "execute/traverse" rights to this directory. It is possible that Cygwin doesn't DTRT with the S-1-5-32-766 well-known SID, which is NT_BUILTIN_CURRENT_OWNER SID. Perhaps it would be a good idea to describe all this on the Cygwin mailing list. > ; in a shell cd to the same 700 folder works fine > $ cd //192.168.0.18/myshare/smb/700 > $ ls > 600 640 644 win So the shell doesn't check, while Emacs does, so what? > $ icacls . > . S-1-5-32-766:(OI)(CI)(RX,W,WDAC,WO,DC) > S-1-5-32-767:(OI)(CI)(Rc,S,REA,RA) > Everyone:(OI)(CI)(Rc,S,REA,RA) > Successfully processed 1 files; Failed processing 0 files > > cygwin emacs-w32 emacs-version "24.3.90.1" > (file-executable-p "//192.168.0.18/myshare/smb/700") > nil > > Native builds do not seem to be affected: > native emacs-version "24.3.1" > (file-executable-p "//192.168.0.18/myshare/smb/700") > t Irrelevant: native Windows Emacs doesn't examine the ACLs, so it simply has no way of knowing this. > Error reading dir-locals: (file-error "Opening input file" "not a > directory" "//mini2012/smb/640/.dir-locals.el") > ; 640 is a regular file, not a directory, but why dir-locals.el ? > Error reading dir-locals: (file-error "Opening input file" "permission > denied" "//mini2012/smb/700/.dir-locals.el") > ; 700 is not group read and searchable, but why dir-locals.el ? > Error: (file-error "Searching for program" "no such file or directory" > "bzr") > ; why does emacs think I want to use bzr with this file? See the relevant functions in files.el. I see no problems here, all of this is expected AFAIU. > Falling back on "slow" status detection ((file-error "Opening input > file" "not a directory" "//mini2012/smb/640/.bzr/checkout/dirstate")) > File exists, but cannot be read As expected, given the ACLs. > insert-directory: Listing directory failed but `access-file' worked > ; which means? It means what it says: you cannot list the directory (i.e. use opendir/readdir APIs), but can successfully call 'access' on it. > I'm having a hard time understanding why you want to put so much faith > in functions that are not reliable now, and will be quite hard or even > genuinely impossible to make reliable in all of quite a large number of > more or less realistic test scenarios. The functions are reliable. It's just that you have some obscure situation with the share owner, file/directory owner, and network connection, and this combination bites you. It might also be a Cygwin issue. But I'm tired of wading through all this, so if file-accessible-directory-p does the trick for you, let's forget about the rest. From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 14:26:23 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 18:26:23 +0000 Received: from localhost ([127.0.0.1]:59563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYS6-00035K-55 for submit@debbugs.gnu.org; Sun, 11 May 2014 14:26:22 -0400 Received: from zhbdzmsp-smta15.bluewin.ch ([195.186.99.132]:50179) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYS3-000355-GJ for 17330@debbugs.gnu.org; Sun, 11 May 2014 14:26:20 -0400 Received: from [195.186.227.131] ([195.186.227.131:33414] helo=zhhdzmsp-smta14.bluewin.ch) by zhbdzmsp-smta15.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 80/8F-15424-4C0CF635; Sun, 11 May 2014 18:26:13 +0000 Received: from [192.168.0.13] (46.127.159.181) by zhhdzmsp-smta14.bluewin.ch (8.5.142) (authenticated as philip.hodges) id 52330D9E108F6D30; Sun, 11 May 2014 18:26:11 +0000 Message-ID: <536FC0C2.6080300@bluewin.ch> Date: Sun, 11 May 2014 20:26:10 +0200 From: Philip Hodges User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> In-Reply-To: <837g5suu67.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: -1.4 (-) >> ; cd to the 700 folder does not, this is clearly a false negative: >> cd-absolute: Cannot cd to //192.168.0.18/myshare/smb/700/: Permission >> denied > > Why is that a false negative? According to this: > >> $ icacls . >> . S-1-5-32-766:(OI)(CI)(RX,W,WDAC,WO,DC) >> S-1-5-32-767:(OI)(CI)(Rc,S,REA,RA) >> Everyone:(OI)(CI)(Rc,S,REA,RA) <<<<<<<<<<<<<<<<<<<< > > you indeed have no "execute/traverse" rights to this directory. It is > possible that Cygwin doesn't DTRT with the S-1-5-32-766 well-known > SID, which is NT_BUILTIN_CURRENT_OWNER SID. Perhaps it would be a > good idea to describe all this on the Cygwin mailing list. It's a false negative because the folder belongs to the host user I connected as, and that user happens to be able to do anything with it, including cd, if only cd-absolute would actually try it. I'm not just "everyone", I also happen to be the owner. Of course in the general case there might be host groups involved too, or even host ACLs. >> ; in a shell cd to the same 700 folder works fine >> $ cd //192.168.0.18/myshare/smb/700 >> $ ls >> 600 640 644 win > > So the shell doesn't check, while Emacs does, so what? Because cd and ls in that directory work in a cygwin shell, but opening and changing to that same directory do not work in cygwin emacs-w32. >> $ icacls . >> . S-1-5-32-766:(OI)(CI)(RX,W,WDAC,WO,DC) >> S-1-5-32-767:(OI)(CI)(Rc,S,REA,RA) >> Everyone:(OI)(CI)(Rc,S,REA,RA) >> Successfully processed 1 files; Failed processing 0 files >> >> cygwin emacs-w32 emacs-version "24.3.90.1" >> (file-executable-p "//192.168.0.18/myshare/smb/700") >> nil >> >> Native builds do not seem to be affected: >> native emacs-version "24.3.1" >> (file-executable-p "//192.168.0.18/myshare/smb/700") >> t > > Irrelevant: native Windows Emacs doesn't examine the ACLs, so it > simply has no way of knowing this. However it got there, whether by guesswork or sheer optimism, it happened to come up with the right answer. >> ... >> I'm having a hard time understanding why you want to put so much faith >> in functions that are not reliable now, and will be quite hard or even >> genuinely impossible to make reliable in all of quite a large number of >> more or less realistic test scenarios. > > The functions are reliable. It's just that you have some obscure > situation with the share owner, file/directory owner, and network > connection, and this combination bites you. It might also be a Cygwin > issue. They are subject to race conditions, false positives and false negatives. They are reliable only in the sense that they generally do return (unless the network hangs, is there any way to stay responsive when that happens?) and the answer is quite often a true positive or true negative. > But I'm tired of wading through all this, so if > file-accessible-directory-p does the trick for you, let's forget about > the rest. I just skimmed through yet another tiring article about how there are fundamental reasons why cygwin can't always get permissions and ACLs exactly right, even without specifically mentioning remote SMB servers. I'm quite convinced the cygwin folks would have already done it if it was actually possible. But I'm also curious about why different SMB implementations make a difference. If it was affecting Samba (recent with SMB2?) on GNU/Linux or Apple's own new SMB in MacOSX 10.9 (which defaults to SMB2.x) instead of just Oracle's Solaris (likely still SMB1) then would you still write it off as obscure? I didn't try a GNU/Linux yet by the way, it took me long enough just to find out how to configure a smb share on Solaris (with zfs commands on 11.2) and have virtualbox make it visible on my network (bridge). I do appreciate your patience and tenacity. This thread just grew and grew longer against my expectations. I wish now that I had done more research and testing up front. And taken more care to note down or remember the getfacl command correctly, instead of recalling it as the typo fgetacl. From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 14:38:22 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 18:38:22 +0000 Received: from localhost ([127.0.0.1]:59568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYdh-0003RH-TS for submit@debbugs.gnu.org; Sun, 11 May 2014 14:38:22 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:49729 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYdc-0003R4-8f for 17330@debbugs.gnu.org; Sun, 11 May 2014 14:38:16 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WjYda-0001Gs-G0; Sun, 11 May 2014 14:38:14 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> X-Spook: hackers Mantis Echelon Verisign Kennedy Sears Tower Jiang X-Ran: jJ/H#[BPl=-qw' (Philip Hodges's message of "Sun, 11 May 2014 20:26:10 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: Eli Zaretskii , 17330@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: -5.7 (-----) I already changed cd-absolute to use file-accessible-directory-p for the next release, and documented that f-a-d-p is preferable to file-executable-p for such purposes. If you think anything else need changing, please say so. Otherwise perhaps this is done. From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 14:43:53 2014 Received: (at 17330) by debbugs.gnu.org; 11 May 2014 18:43:53 +0000 Received: from localhost ([127.0.0.1]:59572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYj2-0003an-SL for submit@debbugs.gnu.org; Sun, 11 May 2014 14:43:53 -0400 Received: from mtaout28.012.net.il ([80.179.55.184]:40859) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjYiz-0003aY-Tj for 17330@debbugs.gnu.org; Sun, 11 May 2014 14:43:51 -0400 Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il (HyperSendmail v2007.08) id <0N5F00E00ALFCZ00@mtaout28.012.net.il> for 17330@debbugs.gnu.org; Sun, 11 May 2014 21:42:02 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout28.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5F00D1DAM1DJ10@mtaout28.012.net.il>; Sun, 11 May 2014 21:42:02 +0300 (IDT) Date: Sun, 11 May 2014 21:43:32 +0300 From: Eli Zaretskii Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p In-reply-to: <536FC0C2.6080300@bluewin.ch> X-012-Sender: halo1@inter.net.il To: Philip Hodges Message-id: <83tx8wtauj.fsf@gnu.org> References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17330 Cc: rgm@gnu.org, 17330@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: Sun, 11 May 2014 20:26:10 +0200 > From: Philip Hodges > CC: rgm@gnu.org, 17330@debbugs.gnu.org > > >> I'm having a hard time understanding why you want to put so much faith > >> in functions that are not reliable now, and will be quite hard or even > >> genuinely impossible to make reliable in all of quite a large number of > >> more or less realistic test scenarios. > > > > The functions are reliable. It's just that you have some obscure > > situation with the share owner, file/directory owner, and network > > connection, and this combination bites you. It might also be a Cygwin > > issue. > > They are subject to race conditions, false positives and false > negatives. They are reliable only in the sense that they generally do > return (unless the network hangs, is there any way to stay responsive > when that happens?) and the answer is quite often a true positive or > true negative. I disagree with this, obviously. Perfectly logical and systematic behavior can appear random and "unreliable" to an observer who does not understand that internal logic. > I just skimmed through yet another tiring article about how there are > fundamental reasons why cygwin can't always get permissions and ACLs > exactly right, even without specifically mentioning remote SMB servers. Those articles are mostly trash, written by people who didn't bother to learn the subject, and instead spread FUD. > I'm quite convinced the cygwin folks would have already done it if it > was actually possible. Maybe they don't know about this. Which is why I think telling them about the problem should be a good idea. They do fix new problems they encounter; e.g., they've just learned about a problem with Microsoft Accounts, and mostly fixed it. > If it was affecting Samba (recent with SMB2?) on GNU/Linux or > Apple's own new SMB in MacOSX 10.9 (which defaults to SMB2.x) > instead of just Oracle's Solaris (likely still SMB1) then would you > still write it off as obscure? Yes. Again, it could also be a Cygwin issue, perhaps due to something that rarely happens or something new. From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 03:01:59 2014 Received: (at 17330) by debbugs.gnu.org; 12 May 2014 07:01:59 +0000 Received: from localhost ([127.0.0.1]:60098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjkFG-0005yS-8X for submit@debbugs.gnu.org; Mon, 12 May 2014 03:01:59 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58493 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjkF8-0005y7-DP for 17330@debbugs.gnu.org; Mon, 12 May 2014 03:01:51 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WjkF7-0001Nf-Qr for 17330@debbugs.gnu.org; Mon, 12 May 2014 03:01:45 -0400 Resent-Message-ID: <21360.29145.716680.890260@gnu.org> Resent-Date: Mon, 12 May 2014 03:01:45 -0400 Resent-From: Glenn Morris Resent-To: 17330@debbugs.gnu.org Bcc: rgm@gnu.org X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) In-Reply-To: Content-Transfer-Encoding: 7bit Message-Id: References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.186.99.133 Date: Sun, 11 May 2014 23:59:12 +0200 From: Philip Hodges To: Glenn Morris Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p X-Bogosity: unsure, spamicity=0.323382, v1.2.1 X-Mailer: Apple Mail (2.1874) X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 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: -5.7 (-----) > I already changed cd-absolute to use file-accessible-directory-p for > the next release, and documented that f-a-d-p is preferable to > file-executable-p for such purposes. > > If you think anything else need changing, please say so. > Otherwise perhaps this is done. The new f-a-d-p completely ignores permissions, and it looks like it is called in all directory check contexts before changing directory or running a process with it as cwd, so I don't see any way it can refuse to try to cd to a directory. As for "anything else": I wonder if it will tell me I cannot start a process to execute a regular file on my share... Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 03:10:32 2014 Received: (at 17330) by debbugs.gnu.org; 12 May 2014 07:10:32 +0000 Received: from localhost ([127.0.0.1]:60103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjkNb-0006FD-EP for submit@debbugs.gnu.org; Mon, 12 May 2014 03:10:31 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58689 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjkNZ-0006F5-BF for 17330@debbugs.gnu.org; Mon, 12 May 2014 03:10:29 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WjkNX-00020f-Lq; Mon, 12 May 2014 03:10:27 -0400 From: Glenn Morris To: Philip Hodges Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> X-Spook: explosion Rubin Islam Abduganievich Karimov Reno FTS2000 X-Ran: zd5cQ87?CWnr)*dOc`'Vb'>z4Q_K7d_[HT_ljU4kh-n`%{g;[@WMYYofp|Hj"XDob X-Hue: white X-Attribution: GM Date: Mon, 12 May 2014 03:10:27 -0400 In-Reply-To: (Philip Hodges's message of "Sun, 11 May 2014 23:59:12 +0200") Message-ID: <80tx8veal8.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -5.7 (-----) (Please keep 17330@debbugs cc'd) Philip Hodges wrote: > The new f-a-d-p completely ignores permissions This is trivially falsifiable: ls -ld foo drwx------ 2 root root 4096 May 12 00:04 foo/ as normal user: (file-accessible-directory-p "foo") ; -> nil > , and it looks like it is called in all directory check contexts > before changing directory or running a process with it as cwd, so I > don't see any way it can refuse to try to cd to a directory. M-x cd foo RET cd-absolute: Cannot cd to /home/gm/foo/: Permission denied > As for "anything else": I wonder if it will tell me I cannot > start a process to execute a regular file on my share... I give up. Whatever you say. From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 03:26:34 2014 Received: (at 17330) by debbugs.gnu.org; 12 May 2014 07:26:34 +0000 Received: from localhost ([127.0.0.1]:60111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjkd6-0006mA-95 for submit@debbugs.gnu.org; Mon, 12 May 2014 03:26:33 -0400 Received: from zhbdzmsp-smta15.bluewin.ch ([195.186.99.132]:57940) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjkd3-0006lq-I9 for 17330@debbugs.gnu.org; Mon, 12 May 2014 03:26:30 -0400 Received: from [195.186.227.131] ([195.186.227.131:35290] helo=zhhdzmsp-smta14.bluewin.ch) by zhbdzmsp-smta15.bluewin.ch (envelope-from ) (ecelerity 3.5.7.40067 r(Platform:3.5.7.0)) with ESMTP id 6D/50-15424-F9770735; Mon, 12 May 2014 07:26:23 +0000 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 52330D9E10996158; Mon, 12 May 2014 07:26:23 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p From: Philip Hodges In-Reply-To: <80tx8veal8.fsf@fencepost.gnu.org> Date: Mon, 12 May 2014 09:26:21 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <95877B32-9A93-4A81-B27B-5DFB369BE48E@bluewin.ch> References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> <80tx8veal8.fsf@fencepost.gnu.org> To: Glenn Morris X-Mailer: Apple Mail (2.1874) X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17330 Cc: 17330@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: -1.4 (-) > The new f-a-d-p completely ignores permissions Sorry, I wasn't completely clear. I did not mean that it overcomes = permissions to give information about the existence of directories that = it cannot even see. Depending on platform the code looks like it checks for a directory = (using faccessat or stat) or checks existence of the . directory within = it. It appears to be making checks that depend on certain permissions = (in other words actually trying it) instead of inspecting permissions = (and being misled by them). From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 23 01:09:23 2021 Received: (at 17330-done) by debbugs.gnu.org; 23 Oct 2021 05:09:23 +0000 Received: from localhost ([127.0.0.1]:34130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1me9HX-00073c-0R for submit@debbugs.gnu.org; Sat, 23 Oct 2021 01:09:23 -0400 Received: from mail-pg1-f182.google.com ([209.85.215.182]:42853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1me9HT-00073K-Ah for 17330-done@debbugs.gnu.org; Sat, 23 Oct 2021 01:09:21 -0400 Received: by mail-pg1-f182.google.com with SMTP id t7so5220479pgl.9 for <17330-done@debbugs.gnu.org>; Fri, 22 Oct 2021 22:09:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=qDwHG42HwSRwGTCfklCMDbLHa8rDqyqR2TFmxn0z0RQ=; b=Dsgy85wnCb4u0R1Wakfzy9olcrGR1hG8Xjpo/j0PxB6DcQm6YDSXtvMIhLoRkGV4T4 RDvpiOOatwmSfYs/Br2ggbNYEUJZmeJXPRAp2Z9RKoJxZyxiITyO9j2TrBBN2OJDjOmx yhyX30ZMi81UeCd6r8+tdMwJmOMSFBUBorcPzahvK5D3UFB4O5Ls2+xUH6z5yQIV+GI4 piUhIgOCLPv4tkwnxnBqTz5Melvisha+QOfqRdlrAP4z7Kej21BjBO+oqLDAFMaq/j5l OMzcbMXzgV+Sa92M0b8mu/Si+eMLCUWEeDHVn82rONWVsizEQi+dpkddYE55dPYw7t5f m0OA== X-Gm-Message-State: AOAM531ewjndrLKR5gAGnmZ3nCh0b5ySS2tQie6u4EnYBs+Yk1jCGHVh yNq7RNs5dE2yfMaF3svo8Ixy7IVda2YTJ++JzhM= X-Google-Smtp-Source: ABdhPJx1OrX8MJdSK3kmnjSBeAwTYE1T8Lzdh2iwX9EKK+0wyQtsEGSXONh0/7cdxPryqwQ4KM/96ogzUamJVuO8wbE= X-Received: by 2002:a05:6a00:244d:b0:44d:c279:5155 with SMTP id d13-20020a056a00244d00b0044dc2795155mr4375247pfj.0.1634965753554; Fri, 22 Oct 2021 22:09:13 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 22 Oct 2021 22:09:12 -0700 From: Stefan Kangas In-Reply-To: (Glenn Morris's message of "Sun, 11 May 2014 14:38:14 -0400") References: <83ha51wj35.fsf@gnu.org> <536B1C56.4040307@bluewin.ch> <838uqcw8fu.fsf@gnu.org> <536F5503.4040607@bluewin.ch> <837g5suu67.fsf@gnu.org> <536FC0C2.6080300@bluewin.ch> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Date: Fri, 22 Oct 2021 22:09:12 -0700 Message-ID: Subject: Re: bug#17330: files.el cd-absolute overcome false negative from file-executable-p To: Glenn Morris Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 17330-done Cc: Eli Zaretskii , Philip Hodges , 17330-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -0.5 (/) Glenn Morris writes: > I already changed cd-absolute to use file-accessible-directory-p for > the next release, and documented that f-a-d-p is preferable to > file-executable-p for such purposes. > > If you think anything else need changing, please say so. > Otherwise perhaps this is done. This was a sprawling discussion that ranged from not getting a recipe to not getting a fix tested. It seems like the conclusion was that this was fixed, and we've heard nothing more in 7.5 years. I'm therefore closing this bug report. If this conclusion is incorrect and this is still an issue, please reply to this email (use "Reply to all" in your email client) and we can reopen the bug report. From unknown Sat Jun 21 03:20:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 20 Nov 2021 12:24:06 +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