[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4e7879f807: Improve handling of `tramp-set-file-uid-gid'
From: |
Michael Albinus |
Subject: |
master 4e7879f807: Improve handling of `tramp-set-file-uid-gid' |
Date: |
Wed, 11 May 2022 12:02:27 -0400 (EDT) |
branch: master
commit 4e7879f807b43416568154d31bc49d3e7393d583
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Improve handling of `tramp-set-file-uid-gid'
* lisp/net/tramp.el (tramp-skeleton-write-region):
Call `tramp-set-file-uid-gid' properly.
(tramp-set-file-uid-gid): Handle also `tramp-crypt-file-name-handler'.
* test/lisp/net/tramp-tests.el (tramp-test27-load): Adapt test.
---
lisp/net/tramp-sh.el | 1 +
lisp/net/tramp.el | 13 +++++++++----
test/lisp/net/tramp-tests.el | 4 +++-
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 74155d1722..1851047ccf 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -6133,4 +6133,5 @@ function cell is returned to be applied on a buffer."
;; * Support hostname canonicalization in ~/.ssh/config.
;; <https://stackoverflow.com/questions/70205232/>
+
;;; tramp-sh.el ends here
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 9413f7954f..b26346443d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3435,7 +3435,7 @@ BODY is the backend specific code."
;; We must protect `last-coding-system-used', now we have
;; set it to its correct value.
- (let (last-coding-system-used)
+ (let (last-coding-system-used (need-chown t))
;; Set file modification time.
(when (or (eq ,visit t) (stringp ,visit))
(when-let ((file-attr (file-attributes filename 'integer)))
@@ -3445,10 +3445,13 @@ BODY is the backend specific code."
;; `file-precious-flag' is set.
(or (file-attribute-modification-time file-attr)
(current-time)))
- ;; Set the ownership.
(unless (and (= (file-attribute-user-id file-attr) uid)
(= (file-attribute-group-id file-attr) gid))
- (tramp-set-file-uid-gid filename uid gid)))))
+ (setq need-chown nil))))
+
+ ;; Set the ownership.
+ (when need-chown
+ (tramp-set-file-uid-gid filename uid gid)))
;; Unlock file.
(when file-locked
@@ -5627,7 +5630,9 @@ If FILENAME is remote, a file name handler is called."
(setq gid (file-attribute-group-id (file-attributes dir)))))
(if (tramp-tramp-file-p filename)
- (tramp-file-name-handler #'tramp-set-file-uid-gid filename uid gid)
+ (funcall (if (tramp-crypt-file-name-p filename)
+ #'tramp-crypt-file-name-handler #'tramp-file-name-handler)
+ #'tramp-set-file-uid-gid filename uid gid)
;; On W32 systems, "chown" does not work.
(unless (memq system-type '(ms-dos windows-nt))
(let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer)))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 643e19c1d2..fa5a614fbf 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4474,7 +4474,9 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
(unwind-protect
(progn
- (load tmp-name 'noerror 'nomessage)
+ ;; Ange-FTP does not tolerate a missing file, even with `noerror'.
+ (unless (tramp--test-ange-ftp-p)
+ (load tmp-name 'noerror 'nomessage))
(should-not (featurep 'tramp-test-load))
(write-region "(provide 'tramp-test-load)" nil tmp-name)
;; `load' in lread.c does not pass `must-suffix'. Why?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 4e7879f807: Improve handling of `tramp-set-file-uid-gid',
Michael Albinus <=