GNU bug report logs -
#10257
23.3.1 Cygwin: network drives - file is write protected (false positive)
Previous Next
Reported by: Jari Aalto <jari.aalto <at> cante.net>
Date: Fri, 9 Dec 2011 18:25:02 UTC
Severity: normal
Found in version 23.3+1-4
Fixed in version 24.0.93
Done: Ken Brown <kbrown <at> cornell.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 12/13/2011 2:27 PM, Stefan Monnier wrote:
>> I have a question about the emacs side of this. I wonder what the rationale
>> is for testing writability before trying to save the file, and then asking
>> the user for confirmation in case the (unreliable) test for writability
>> fails (*).
>
> Can you point us to the piece of code about which you're talking?
> Ideally, show us a sample pseudo patch (even better if it compiles, even
> better if it works) showing the kind of change you have in mind.
The code I'm talking about is near the beginning of the definition of
`basic-save-buffer-2' in files.el:
(if (not (file-writable-p buffer-file-name))
(let ((dir (file-name-directory buffer-file-name)))
(if (not (file-directory-p dir))
(if (file-exists-p dir)
(error "%s is not a directory" dir)
(error "%s: no such directory" dir))
(if (not (file-exists-p buffer-file-name))
(error "Directory %s write-protected" dir)
(if (yes-or-no-p
(format
"File %s is write-protected; try to save anyway? "
(file-name-nondirectory
buffer-file-name)))
(setq tempsetmodes t)
(error "Attempt to save to a file which you aren't allowed to write"))))))
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 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. If the file really is write-protected, there will be an error.
If you agree, then I guess I would propose the following patch (not yet
tested):
=== modified file 'lisp/files.el'
--- lisp/files.el 2011-12-04 08:02:42 +0000
+++ lisp/files.el 2011-12-13 20:08:55 +0000
@@ -4456,13 +4456,7 @@
(error "%s: no such directory" dir))
(if (not (file-exists-p buffer-file-name))
(error "Directory %s write-protected" dir)
- (if (yes-or-no-p
- (format
- "File %s is write-protected; try to save anyway? "
- (file-name-nondirectory
- buffer-file-name)))
- (setq tempsetmodes t)
- (error "Attempt to save to a file which you aren't
allowed to write"))))))
+ (setq tempsetmodes t)))))
(or buffer-backed-up
(setq setmodes (backup-buffer)))
(let* ((dir (file-name-directory buffer-file-name))
Ken
This bug report was last modified 13 years and 237 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.