diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2012-12-29 16:32:36 +0200 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2012-12-29 16:32:36 +0200 |
| commit | ccad023bc3c70fc8368c00f7ed2f5ec947a4260d (patch) | |
| tree | c6471cecd468c61a1a81860215f731e265721a88 /lisp/files.el | |
| parent | ccb1c17e8bf1aa0d21bddd9fa37154a120657f52 (diff) | |
| download | emacs-ccad023bc3c70fc8368c00f7ed2f5ec947a4260d.tar.gz | |
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/files.el')
| -rw-r--r-- | lisp/files.el | 20 |
1 files changed, 14 insertions, 6 deletions
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." nil))) ;; Reset the umask. (set-default-file-modes umask))) - (and modes - (set-file-modes to-name (logand modes #o1777))) - (and extended-attributes - (set-file-extended-attributes to-name extended-attributes))) + ;; If set-file-extended-attributes fails, fall back on set-file-modes. + (unless (and extended-attributes + (with-demoted-errors + (set-file-extended-attributes to-name extended-attributes))) + (and modes + (set-file-modes to-name (logand modes #o1777))))) (defvar file-name-version-regexp "\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)" @@ -4737,8 +4739,14 @@ Before and after saving the buffer, this function runs (setq setmodes (list (file-modes buffer-file-name) (file-extended-attributes buffer-file-name) buffer-file-name)) - (set-file-modes buffer-file-name (logior (car setmodes) 128)) - (set-file-extended-attributes buffer-file-name (nth 1 setmodes))))) + ;; If set-file-extended-attributes fails, fall back on + ;; set-file-modes. + (unless + (with-demoted-errors + (set-file-extended-attributes buffer-file-name + (nth 1 setmodes))) + (set-file-modes buffer-file-name + (logior (car setmodes) 128)))))) (let (success) (unwind-protect (progn |
