[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10257: 23.3.1 Cygwin: network drives - file is write protected (fals
From: |
Stefan Monnier |
Subject: |
bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive) |
Date: |
Tue, 13 Dec 2011 21:54:39 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
> 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
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Jari Aalto, 2011/12/09
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/09
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jaalto, 2011/12/10
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Stefan Monnier, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive),
Stefan Monnier <=
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Jari Aalto, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14