emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set-file-extended-attributes and backups


From: Eli Zaretskii
Subject: set-file-extended-attributes and backups
Date: Fri, 21 Dec 2012 16:53:25 +0200

Fabrice reported that since the introduction of ACLs into backing up
of files (as part as saving a buffer), he gets errors (on MS-Windows
8).  It turns out his user profile doesn't have the privileges to set
file security descriptors.  This can be fixed by granting the
privileges in the local policy, but the issue I raise is should this
problem be exposed in the context of backing up and saving files?

I think this problem is not Windows-specific.  So I'm asking here:
does it make sense to fail backup-buffer and backup-buffer-copy just
because set-file-extended-attributes fails?  I think we should ignore
such errors in these cases, and propose the changes below.

P.S.  If anyone wants to argue that set-file-acl should ignore this,
then I disagree: it's up to the application to decide whether or not
to ignore such problems.

=== modified file 'lisp/files.el'
--- lisp/files.el       2012-12-17 15:51:49 +0000
+++ lisp/files.el       2012-12-21 12:10:16 +0000
@@ -4022,7 +4022,8 @@ BACKUPNAME is the backup file name, whic
   (and modes
        (set-file-modes to-name (logand modes #o1777)))
   (and extended-attributes
-       (set-file-extended-attributes to-name extended-attributes)))
+       (ignore-errors
+        (set-file-extended-attributes to-name extended-attributes))))
 
 (defvar file-name-version-regexp
   "\\(?:~\\|\\.~[-[:alnum:]:address@hidden(?:~[[:digit:]]+\\)?~\\)"
@@ -4738,7 +4739,9 @@ Before and after saving the buffer, this
                                    (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)))))
+              (ignore-errors
+                (set-file-extended-attributes buffer-file-name
+                                              (nth 1 setmodes))))))
        (let (success)
          (unwind-protect
              (progn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]