;; 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)))
;; `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
(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)))
(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?