From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive) Date: Tue, 13 Dec 2011 22:27:11 -0500 Message-ID: <4EE8178F.5040004@cornell.edu> References: <87aa71mwng.fsf@picasso.cante.net> <4EE270AA.2080702@cornell.edu> <20111210095858.GA19881@cante.cante.net> <4EE742B0.1080703@cornell.edu> <20111213140042.GA22678@picasso.cante.net> <4EE76B6E.7070904@cornell.edu> <4EE7B2A9.6060308@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1323833271 30841 80.91.229.12 (14 Dec 2011 03:27:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2011 03:27:51 +0000 (UTC) Cc: 10257@debbugs.gnu.org, jari To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 14 04:27:46 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RafVS-0001fX-E5 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Dec 2011 04:27:46 +0100 Original-Received: from localhost ([::1]:46905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RafVR-0007OT-HR for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Dec 2011 22:27:45 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:56458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RafVO-0007Ms-9Q for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 22:27:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RafVN-0000YM-9l for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 22:27:42 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RafVN-0000YI-4i for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 22:27:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RafWg-00060d-2b for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 22:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Dec 2011 03:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10257-submit@debbugs.gnu.org id=B10257.132383332223069 (code B ref 10257); Wed, 14 Dec 2011 03:29:02 +0000 Original-Received: (at 10257) by debbugs.gnu.org; 14 Dec 2011 03:28:42 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RafWM-000602-4n for submit@debbugs.gnu.org; Tue, 13 Dec 2011 22:28:42 -0500 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141] helo=authusersmtp.mail.cornell.edu) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RafWJ-0005zu-DU for 10257@debbugs.gnu.org; Tue, 13 Dec 2011 22:28:40 -0500 Original-Received: from [192.168.1.3] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id pBE3RFXQ012348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 13 Dec 2011 22:27:16 -0500 (EST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Dec 2011 22:29:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:54934 Archived-At: On 12/13/2011 9:54 PM, Stefan Monnier wrote: >> The code I'm talking about is near the beginning of the definition of >> basic-save-buffer-2' in files.el: > > Thanks. > >> I'm not (yet) proposing a change. I'm simply asking what the rationale is >> for calling `yes-or-no-p' and making the user confirm that s/he wants to try >> to save the file. > > I'm not sure what was the intention, but I know that this code is > triggered in cases such as: > - running as root: write will always succeed. > - saving to a read-only file that you own: while `write' will fail, > you can make it succeed by changing the access rights (which is what > tempsetmodes is for). > - saving to a read-only file in a writable dir: write will fail, but > you can make it succeed by calling unlink first [Not sure if this > works in Emacs right now]. > In all these cases, Emacs is able to write the file, but the read-only > bit expresses an intention not to modify the file so it makes sense to > ask for confirmation. There's a fourth case, and that's what led to the present bug report (by Jari): - saving to a file that is in fact writable, for which file-writable-p gives the wrong answer. > This said, the code you quote should never prevent you from saving > a file, it should only ask for confirmation (i.e. it might be annoying > but it shouldn't prevent you from getting your work done). Jari was annoyed to the point where he felt he couldn't get his work done. He's in a situation where file-writable-p will consistently report that a file is not writable, but writing will in fact succeed. I was trying to help him find a way to avoid having to repeatedly confirm that he wants to save. > But other than for the "running as root" case, the above two cases could > replace the `file-writable-p' test with a `write-region' test: > file-writable-p is documented (via POSIX's documentation of `access') to > be an approximation, whereas `write-region' should reliably tell us > whether we can write to the file. So that sounds like a solution to Jari's problem. I'll leave it to him to propose a patch along those lines. Ken