From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive) Date: Tue, 13 Dec 2011 21:54:39 -0500 Message-ID: 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 X-Trace: dough.gmane.org 1323831354 21100 80.91.229.12 (14 Dec 2011 02:55:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2011 02:55:54 +0000 (UTC) Cc: 10257@debbugs.gnu.org, jari To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 14 03:55:49 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 1Raf0U-0000AV-Bp for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Dec 2011 03:55:46 +0100 Original-Received: from localhost ([::1]:38998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Raf0T-0002PS-Mw for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Dec 2011 21:55:45 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:60044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Raf0Q-0002Od-Qq for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 21:55:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Raf0P-0003i7-Nf for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 21:55:42 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Raf0P-0003i1-M8 for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 21:55:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Raf1i-0005HS-1u for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2011 21:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Dec 2011 02:57:01 +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.132383137020239 (code B ref 10257); Wed, 14 Dec 2011 02:57:01 +0000 Original-Received: (at 10257) by debbugs.gnu.org; 14 Dec 2011 02:56:10 +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 1Raf0s-0005GN-0G for submit@debbugs.gnu.org; Tue, 13 Dec 2011 21:56:10 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Raf0p-0005GG-Vf for 10257@debbugs.gnu.org; Tue, 13 Dec 2011 21:56:08 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id pBE2sdwn003646; Tue, 13 Dec 2011 21:54:39 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A3F5BB42CF; Tue, 13 Dec 2011 21:54:39 -0500 (EST) In-Reply-To: <4EE7B2A9.6060308@cornell.edu> (Ken Brown's message of "Tue, 13 Dec 2011 15:16:41 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4070=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4070> : streams <710396> : uri <1027433> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Dec 2011 21:57: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:54933 Archived-At: > 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. 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). 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. > I don't see that any harm would come from just trying to > do what the user asked for, without making him/her ask a second time. I'm not sure what second time you're thinking of. > If you agree, then I guess I would propose the following patch (not yet > tested): Your patch would probably remove the ability to save to a read-only file. Stefan