aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2012-12-29 16:32:36 +0200
committerEli Zaretskii2012-12-29 16:32:36 +0200
commitccad023bc3c70fc8368c00f7ed2f5ec947a4260d (patch)
treec6471cecd468c61a1a81860215f731e265721a88 /lisp
parentccb1c17e8bf1aa0d21bddd9fa37154a120657f52 (diff)
downloademacs-ccad023bc3c70fc8368c00f7ed2f5ec947a4260d.tar.gz
emacs-ccad023bc3c70fc8368c00f7ed2f5ec947a4260d.zip
Fix bug #13298 with failed backups by falling back on set-file-modes.
src/fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if file's SELinux context or ACLs successfully set, nil otherwise. lisp/files.el (backup-buffer-copy, basic-save-buffer-2): If set-file-extended-attributes fails, fall back on set-file-modes instead of signaling an error. doc/lispref/files.texi (Changing Files): Document the return values of set-file-selinux-context and set-file-acl.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/files.el20
2 files changed, 20 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b79d174d35e..0beb4a73185 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-12-29 Eli Zaretskii <eliz@gnu.org>
2
3 * files.el (backup-buffer-copy, basic-save-buffer-2): If
4 set-file-extended-attributes fails, fall back on set-file-modes
5 instead of signaling an error. (Bug#13298)
6
12012-12-29 Fabián Ezequiel Gallina <fgallina@cuca> 72012-12-29 Fabián Ezequiel Gallina <fgallina@cuca>
2 8
3 * progmodes/python.el: Support other commands triggering 9 * progmodes/python.el: Support other commands triggering
diff --git a/lisp/files.el b/lisp/files.el
index f076530fbc8..fb82d0dbe1f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4019,10 +4019,12 @@ BACKUPNAME is the backup file name, which is the old file renamed."
4019 nil))) 4019 nil)))
4020 ;; Reset the umask. 4020 ;; Reset the umask.
4021 (set-default-file-modes umask))) 4021 (set-default-file-modes umask)))
4022 (and modes 4022 ;; If set-file-extended-attributes fails, fall back on set-file-modes.
4023 (set-file-modes to-name (logand modes #o1777))) 4023 (unless (and extended-attributes
4024 (and extended-attributes 4024 (with-demoted-errors
4025 (set-file-extended-attributes to-name extended-attributes))) 4025 (set-file-extended-attributes to-name extended-attributes)))
4026 (and modes
4027 (set-file-modes to-name (logand modes #o1777)))))
4026 4028
4027(defvar file-name-version-regexp 4029(defvar file-name-version-regexp
4028 "\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)" 4030 "\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)"
@@ -4737,8 +4739,14 @@ Before and after saving the buffer, this function runs
4737 (setq setmodes (list (file-modes buffer-file-name) 4739 (setq setmodes (list (file-modes buffer-file-name)
4738 (file-extended-attributes buffer-file-name) 4740 (file-extended-attributes buffer-file-name)
4739 buffer-file-name)) 4741 buffer-file-name))
4740 (set-file-modes buffer-file-name (logior (car setmodes) 128)) 4742 ;; If set-file-extended-attributes fails, fall back on
4741 (set-file-extended-attributes buffer-file-name (nth 1 setmodes))))) 4743 ;; set-file-modes.
4744 (unless
4745 (with-demoted-errors
4746 (set-file-extended-attributes buffer-file-name
4747 (nth 1 setmodes)))
4748 (set-file-modes buffer-file-name
4749 (logior (car setmodes) 128))))))
4742 (let (success) 4750 (let (success)
4743 (unwind-protect 4751 (unwind-protect
4744 (progn 4752 (progn