summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sudoedit.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2021-07-25 14:14:49 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-07-25 14:14:49 +0200
commit41e62df73af373f30a89281b25be0344b14cf98b (patch)
tree9ccc6470ce1d853f23bec0b1168af141745f1691 /lisp/net/tramp-sudoedit.el
parentcb28b2e32bcd694e1684b5390a709057ffab5820 (diff)
downloademacs-41e62df73af373f30a89281b25be0344b14cf98b.tar.gz
Fix extended attributes for Tramp's sudoedit method (bug#49724)
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Remove compat code for `{set-}file-extended-attributes'. (tramp-sudoedit-handle-write-region): Handle extended attributes. (Bug#49724) * test/lisp/net/tramp-tests.el (tramp-test25-file-selinux): Fix test for sudoedit method.
Diffstat (limited to 'lisp/net/tramp-sudoedit.el')
-rw-r--r--lisp/net/tramp-sudoedit.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 177dde67cca..e4d90dde701 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -237,7 +237,7 @@ absolute file names."
(file-attributes filename)))
(file-modes (tramp-default-file-modes filename))
(attributes (and preserve-extended-attributes
- (apply #'file-extended-attributes (list filename))))
+ (file-extended-attributes filename)))
(sudoedit-operation
(cond
((and (eq op 'copy) preserve-uid-gid) '("cp" "-f" "-p"))
@@ -293,7 +293,7 @@ absolute file names."
;; errors, because ACL strings could be incompatible.
(when attributes
(ignore-errors
- (apply #'set-file-extended-attributes (list newname attributes))))
+ (set-file-extended-attributes newname attributes)))
(when (and t1 (eq op 'rename))
(with-parsed-tramp-file-name filename v1
@@ -726,13 +726,14 @@ ID-FORMAT valid values are `string' and `integer'."
(file-attributes filename 'integer))
(tramp-get-remote-gid v 'integer)))
(flag (and (eq mustbenew 'excl) 'nofollow))
- (modes (tramp-default-file-modes filename flag)))
+ (modes (tramp-default-file-modes filename flag))
+ (attributes (file-extended-attributes filename)))
(prog1
(tramp-handle-write-region
start end filename append visit lockname mustbenew)
- ;; Set the ownership and modes. This is not performed in
- ;; `tramp-handle-write-region'.
+ ;; Set the ownership, modes and extended attributes. This is
+ ;; not performed in `tramp-handle-write-region'.
(unless (and (= (tramp-compat-file-attribute-user-id
(file-attributes filename 'integer))
uid)
@@ -740,7 +741,12 @@ ID-FORMAT valid values are `string' and `integer'."
(file-attributes filename 'integer))
gid))
(tramp-set-file-uid-gid filename uid gid))
- (tramp-compat-set-file-modes filename modes flag)))))
+ (tramp-compat-set-file-modes filename modes flag)
+ ;; We ignore possible errors, because ACL strings could be
+ ;; incompatible.
+ (when attributes
+ (ignore-errors
+ (set-file-extended-attributes filename attributes)))))))
;; Internal functions.