Subject: bug#36940: tests slowness and failure after recent Tramp changes

From: Paul Eggert <[email-masked]>
Date: Mon, 26 Aug 2019 19:17:01 -0700

Michael Albinus wrote:
> You might install the patch, and also adapt the templates in
> `tramp-do-file-attributes-with-stat and'
> `tramp-do-directory-files-and-attributes-with-stat'.

Thanks, I missed those templates. I adapted them too and installed the attached 
combined patch into master.
>From 0e2d559daf43a04024ceaacfc8844839af2d50df Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Mon, 26 Aug 2019 18:57:56 -0700
Subject: [PATCH] Fix Tramp rounding of file sizes and inode numbers

* lisp/net/tramp-sh.el (tramp-perl-file-attributes)
(tramp-perl-directory-files-and-attributes)
(tramp-do-file-attributes-with-stat)
(tramp-do-directory-files-and-attributes-with-stat):
Format file sizes and inode numbers without trailing ".0",
to avoid rounding errors when absolute values exceed 2**53
(Bug#36940#94).  This fixes the problem for Emacs 27 and later,
and doesn't hurt in earlier Emacs.
---
 lisp/net/tramp-sh.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 1f7c8f6e49..217e73a24b 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -669,7 +669,7 @@ tramp-perl-file-attributes
 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
 printf(
-    \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t %%u.0 -1)\\n\",
+    \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
     $type,
     $stat[3],
     $uid,
@@ -719,7 +719,7 @@ tramp-perl-directory-files-and-attributes
     $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
     $filename =~ s/\"/\\\\\"/g;
     printf(
-        \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t %%u.0 -1)\\n\",
+        \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
         $filename,
         $type,
         $stat[3],
@@ -1353,7 +1353,7 @@ tramp-do-file-attributes-with-stat
        ;; `tramp-stat-marker', in order to make a proper shell escape
        ;; of them in file names.
        "( (%s %s || %s -h %s) && (%s -c "
-       "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s.0 %s%%A%s t %%i.0 -1)' "
+       "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
        "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)"))
     (tramp-get-file-exists-command vec)
     (tramp-shell-quote-argument localname)
@@ -1764,7 +1764,7 @@ tramp-do-directory-files-and-attributes-with-stat
        ;; of them in file names.
        "cd %s && echo \"(\"; (%s %s -a | "
        "xargs %s -c "
-       "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s.0 %s%%A%s t %%i.0 -1)' "
+       "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
        "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\""))
     (tramp-shell-quote-argument localname)
     (tramp-get-ls-command vec)
-- 
2.17.1