aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-08-26 18:57:56 -0700
committerPaul Eggert2019-08-26 19:09:22 -0700
commit0e2d559daf43a04024ceaacfc8844839af2d50df (patch)
tree187a5dddaca64b2820caaeee2125c311a9ed2813
parent3ef6849b458893669b1d83653e3672f7f1ac56cd (diff)
downloademacs-0e2d559daf43a04024ceaacfc8844839af2d50df.tar.gz
emacs-0e2d559daf43a04024ceaacfc8844839af2d50df.zip
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.
-rw-r--r--lisp/net/tramp-sh.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 1f7c8f6e491..217e73a24bc 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -669,7 +669,7 @@ else
669$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; 669$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
670$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 670$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
671printf( 671printf(
672 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t %%u.0 -1)\\n\", 672 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
673 $type, 673 $type,
674 $stat[3], 674 $stat[3],
675 $uid, 675 $uid,
@@ -719,7 +719,7 @@ for($i = 0; $i < $n; $i++)
719 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 719 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
720 $filename =~ s/\"/\\\\\"/g; 720 $filename =~ s/\"/\\\\\"/g;
721 printf( 721 printf(
722 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t %%u.0 -1)\\n\", 722 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
723 $filename, 723 $filename,
724 $type, 724 $type,
725 $stat[3], 725 $stat[3],
@@ -1353,7 +1353,7 @@ component is used as the target of the symlink."
1353 ;; `tramp-stat-marker', in order to make a proper shell escape 1353 ;; `tramp-stat-marker', in order to make a proper shell escape
1354 ;; of them in file names. 1354 ;; of them in file names.
1355 "( (%s %s || %s -h %s) && (%s -c " 1355 "( (%s %s || %s -h %s) && (%s -c "
1356 "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s.0 %s%%A%s t %%i.0 -1)' " 1356 "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
1357 "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)")) 1357 "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)"))
1358 (tramp-get-file-exists-command vec) 1358 (tramp-get-file-exists-command vec)
1359 (tramp-shell-quote-argument localname) 1359 (tramp-shell-quote-argument localname)
@@ -1764,7 +1764,7 @@ of."
1764 ;; of them in file names. 1764 ;; of them in file names.
1765 "cd %s && echo \"(\"; (%s %s -a | " 1765 "cd %s && echo \"(\"; (%s %s -a | "
1766 "xargs %s -c " 1766 "xargs %s -c "
1767 "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s.0 %s%%A%s t %%i.0 -1)' " 1767 "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
1768 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")) 1768 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\""))
1769 (tramp-shell-quote-argument localname) 1769 (tramp-shell-quote-argument localname)
1770 (tramp-get-ls-command vec) 1770 (tramp-get-ls-command vec)