Commit c252cd9d authored by Michael Albinus's avatar Michael Albinus

Improve tramp-convert-file-attributes backward compatibility

* lisp/net/tramp-sh.el (tramp-convert-file-attributes):
Use `seconds-to-time' for {access, modification, status change}
time.  Simplify check for inode.

* test/lisp/net/tramp-tests.el (tramp-test22-file-times):
Use `seconds-to-time'.
parent 190e85b8
......@@ -5116,19 +5116,13 @@ Return ATTR."
(setcar (nthcdr 3 attr) (round (nth 3 attr))))
;; Convert last access time.
(unless (listp (nth 4 attr))
(setcar (nthcdr 4 attr)
(list (floor (nth 4 attr) 65536)
(floor (mod (nth 4 attr) 65536)))))
(setcar (nthcdr 4 attr) (seconds-to-time (nth 4 attr))))
;; Convert last modification time.
(unless (listp (nth 5 attr))
(setcar (nthcdr 5 attr)
(list (floor (nth 5 attr) 65536)
(floor (mod (nth 5 attr) 65536)))))
(setcar (nthcdr 5 attr) (seconds-to-time (nth 5 attr))))
;; Convert last status change time.
(unless (listp (nth 6 attr))
(setcar (nthcdr 6 attr)
(list (floor (nth 6 attr) 65536)
(floor (mod (nth 6 attr) 65536)))))
(setcar (nthcdr 6 attr) (seconds-to-time (nth 6 attr))))
;; Convert file size.
(when (< (nth 7 attr) 0)
(setcar (nthcdr 7 attr) -1))
......@@ -5158,8 +5152,8 @@ Return ATTR."
(not (string-equal
(nth 3 attr)
(tramp-get-remote-gid vec 'string)))))
;; Convert inode. Big numbers have been added to Emacs 27.
(unless (or (fboundp 'bignump) (listp (nth 10 attr)))
;; Convert inode.
(when (floatp (nth 10 attr))
(setcar (nthcdr 10 attr)
(condition-case nil
(let ((high (nth 10 attr))
......
......@@ -3219,11 +3219,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; `current-time'. Therefore, we use '(0 1). We skip the
;; test, if the remote handler is not able to set the
;; correct time.
(skip-unless (set-file-times tmp-name1 '(0 1)))
(skip-unless (set-file-times tmp-name1 (seconds-to-time 1)))
;; Dumb remote shells without perl(1) or stat(1) are not
;; able to return the date correctly. They say "don't know".
(unless (equal (nth 5 (file-attributes tmp-name1)) '(0 0))
(should (equal (nth 5 (file-attributes tmp-name1)) '(0 1)))
(should
(equal (nth 5 (file-attributes tmp-name1)) (seconds-to-time 1)))
(write-region "bla" nil tmp-name2)
(should (file-exists-p tmp-name2))
(should (file-newer-than-file-p tmp-name2 tmp-name1))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment