emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c252cd9: Improve tramp-convert-file-attributes back


From: Michael Albinus
Subject: [Emacs-diffs] master c252cd9: Improve tramp-convert-file-attributes backward compatibility
Date: Wed, 29 Aug 2018 04:05:44 -0400 (EDT)

branch: master
commit c252cd9d207ab8442f011630005e467ad118bd3a
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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'.
---
 lisp/net/tramp-sh.el         | 16 +++++-----------
 test/lisp/net/tramp-tests.el |  5 +++--
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8cf7318..64d2081 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -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))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 293a005..55884f3 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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))



reply via email to

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