From 6a9ff1c6386d8e6d8a245cdcf01038377c25828e Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 7 Jun 2022 20:03:41 +0200 Subject: [PATCH] Demote extended attribute errors in basic-save-buffer-2 * lisp/files.el (basic-save-buffer-2): Give demoted errors when reading extended attributes that fail (bug#43723). --- lisp/files.el | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index d876a76119c..a505f62af81 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5725,11 +5725,14 @@ Before and after saving the buffer, this function runs (signal (car err) (cdr err)))) ;; Since we have created an entirely new file, ;; make sure it gets the right permission bits set. - (setq setmodes (or setmodes - (list (or (file-modes buffer-file-name) - (logand ?\666 (default-file-modes))) - (file-extended-attributes buffer-file-name) - buffer-file-name))) + (setq setmodes + (or setmodes + (list (or (file-modes buffer-file-name) + (logand ?\666 (default-file-modes))) + (with-demoted-errors + "Error getting extended attributes: %s" + (file-extended-attributes buffer-file-name)) + buffer-file-name))) ;; We succeeded in writing the temp file, ;; so rename it. (rename-file tempname @@ -5746,9 +5749,12 @@ Before and after saving the buffer, this function runs ;; (setmodes is set) because that says we're superseding. (cond ((and tempsetmodes (not setmodes)) ;; Change the mode back, after writing. - (setq setmodes (list (file-modes buffer-file-name) - (file-extended-attributes buffer-file-name) - buffer-file-name)) + (setq setmodes + (list (file-modes buffer-file-name) + (with-demoted-errors + "Error getting extended attributes: %s" + (file-extended-attributes buffer-file-name)) + buffer-file-name)) ;; If set-file-extended-attributes fails, fall back on ;; set-file-modes. (unless -- 2.39.2