aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2018-08-28 16:27:02 +0200
committerMichael Albinus2018-08-28 16:27:02 +0200
commitadcf904b3a7f8c5b8a82a40725ef7baa3a76c993 (patch)
treee44dad4a8ae06609d992acb0b68c309758e072c6
parentd77d01d22902acdc45c2c7059de4f1b158ab5806 (diff)
downloademacs-adcf904b3a7f8c5b8a82a40725ef7baa3a76c993.tar.gz
emacs-adcf904b3a7f8c5b8a82a40725ef7baa3a76c993.zip
Add bignum support in Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-file-system-info): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-system-info): * lisp/net/tramp-sh.el (tramp-do-file-attributes-with-stat) (tramp-do-directory-files-and-attributes-with-stat) (tramp-sh-handle-file-system-info): * lisp/net/tramp-smb.el (tramp-smb-handle-file-system-info): Do not add "e0" to integers. * lisp/net/tramp-sh.el (tramp-perl-file-attributes) (tramp-convert-file-attributes): Do not use a consp for the inode if there is bignum support.
-rw-r--r--lisp/net/tramp-adb.el8
-rw-r--r--lisp/net/tramp-gvfs.el7
-rw-r--r--lisp/net/tramp-sh.el29
-rw-r--r--lisp/net/tramp-smb.el11
4 files changed, 25 insertions, 30 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 297bdd712f6..35b0fdda623 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -265,12 +265,12 @@ pass to the OPERATION."
265 "[[:space:]]+\\([[:digit:]]+\\)")) 265 "[[:space:]]+\\([[:digit:]]+\\)"))
266 ;; The values are given as 1k numbers, so we must change 266 ;; The values are given as 1k numbers, so we must change
267 ;; them to number of bytes. 267 ;; them to number of bytes.
268 (list (* 1024 (string-to-number (concat (match-string 1) "e0"))) 268 (list (* 1024 (string-to-number (match-string 1)))
269 ;; The second value is the used size. We need the 269 ;; The second value is the used size. We need the
270 ;; free size. 270 ;; free size.
271 (* 1024 (- (string-to-number (concat (match-string 1) "e0")) 271 (* 1024 (- (string-to-number (match-string 1))
272 (string-to-number (concat (match-string 2) "e0")))) 272 (string-to-number (match-string 2))))
273 (* 1024 (string-to-number (concat (match-string 3) "e0"))))))))) 273 (* 1024 (string-to-number (match-string 3)))))))))
274 274
275;; This is derived from `tramp-sh-handle-file-truename'. Maybe the 275;; This is derived from `tramp-sh-handle-file-truename'. Maybe the
276;; code could be shared? 276;; code could be shared?
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 84af410de07..f46ddc68ae4 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1273,10 +1273,9 @@ file-notify events."
1273 (used (cdr (assoc "filesystem::used" attr))) 1273 (used (cdr (assoc "filesystem::used" attr)))
1274 (free (cdr (assoc "filesystem::free" attr)))) 1274 (free (cdr (assoc "filesystem::free" attr))))
1275 (when (and (stringp size) (stringp used) (stringp free)) 1275 (when (and (stringp size) (stringp used) (stringp free))
1276 (list (string-to-number (concat size "e0")) 1276 (list (string-to-number size)
1277 (- (string-to-number (concat size "e0")) 1277 (- (string-to-number size) (string-to-number used))
1278 (string-to-number (concat used "e0"))) 1278 (string-to-number free))))))
1279 (string-to-number (concat free "e0")))))))
1280 1279
1281(defun tramp-gvfs-handle-file-writable-p (filename) 1280(defun tramp-gvfs-handle-file-writable-p (filename)
1282 "Like `file-writable-p' for Tramp files." 1281 "Like `file-writable-p' for Tramp files."
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 86e82d40929..8cf7318adaa 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -694,7 +694,7 @@ else
694$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; 694$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
695$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 695$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
696printf( 696printf(
697 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) -1)\\n\", 697 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
698 $type, 698 $type,
699 $stat[3], 699 $stat[3],
700 $uid, 700 $uid,
@@ -707,8 +707,7 @@ printf(
707 $stat[10] & 0xffff, 707 $stat[10] & 0xffff,
708 $stat[7], 708 $stat[7],
709 $stat[2], 709 $stat[2],
710 $stat[1] >> 16 & 0xffff, 710 $stat[1]
711 $stat[1] & 0xffff
712);' \"$1\" \"$2\" 2>/dev/null" 711);' \"$1\" \"$2\" 2>/dev/null"
713 "Perl script to produce output suitable for use with `file-attributes' 712 "Perl script to produce output suitable for use with `file-attributes'
714on the remote file system. 713on the remote file system.
@@ -1393,7 +1392,7 @@ component is used as the target of the symlink."
1393 ;; `tramp-stat-marker', in order to make a proper shell escape of 1392 ;; `tramp-stat-marker', in order to make a proper shell escape of
1394 ;; them in file names. 1393 ;; them in file names.
1395 "( (%s %s || %s -h %s) && (%s -c " 1394 "( (%s %s || %s -h %s) && (%s -c "
1396 "'((%s%%N%s) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 -1)' " 1395 "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
1397 "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)") 1396 "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)")
1398 (tramp-get-file-exists-command vec) 1397 (tramp-get-file-exists-command vec)
1399 (tramp-shell-quote-argument localname) 1398 (tramp-shell-quote-argument localname)
@@ -1402,9 +1401,9 @@ component is used as the target of the symlink."
1402 (tramp-get-remote-stat vec) 1401 (tramp-get-remote-stat vec)
1403 tramp-stat-marker tramp-stat-marker 1402 tramp-stat-marker tramp-stat-marker
1404 (if (eq id-format 'integer) 1403 (if (eq id-format 'integer)
1405 "%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker)) 1404 "%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
1406 (if (eq id-format 'integer) 1405 (if (eq id-format 'integer)
1407 "%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker)) 1406 "%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
1408 tramp-stat-marker tramp-stat-marker 1407 tramp-stat-marker tramp-stat-marker
1409 (tramp-shell-quote-argument localname) 1408 (tramp-shell-quote-argument localname)
1410 tramp-stat-quoted-marker))) 1409 tramp-stat-quoted-marker)))
@@ -1825,7 +1824,7 @@ be non-negative integers."
1825 ;; make a proper shell escape of them in file names. 1824 ;; make a proper shell escape of them in file names.
1826 "cd %s && echo \"(\"; (%s %s -a | " 1825 "cd %s && echo \"(\"; (%s %s -a | "
1827 "xargs %s -c " 1826 "xargs %s -c "
1828 "'(%s%%n%s (%s%%N%s) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 -1)' " 1827 "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
1829 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"") 1828 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")
1830 (tramp-shell-quote-argument localname) 1829 (tramp-shell-quote-argument localname)
1831 (tramp-get-ls-command vec) 1830 (tramp-get-ls-command vec)
@@ -1836,9 +1835,9 @@ be non-negative integers."
1836 tramp-stat-marker tramp-stat-marker 1835 tramp-stat-marker tramp-stat-marker
1837 tramp-stat-marker tramp-stat-marker 1836 tramp-stat-marker tramp-stat-marker
1838 (if (eq id-format 'integer) 1837 (if (eq id-format 'integer)
1839 "%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker)) 1838 "%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
1840 (if (eq id-format 'integer) 1839 (if (eq id-format 'integer)
1841 "%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker)) 1840 "%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
1842 tramp-stat-marker tramp-stat-marker 1841 tramp-stat-marker tramp-stat-marker
1843 tramp-stat-quoted-marker))) 1842 tramp-stat-quoted-marker)))
1844 1843
@@ -3806,12 +3805,12 @@ file-notify events."
3806 (concat "[[:space:]]*\\([[:digit:]]+\\)" 3805 (concat "[[:space:]]*\\([[:digit:]]+\\)"
3807 "[[:space:]]+\\([[:digit:]]+\\)" 3806 "[[:space:]]+\\([[:digit:]]+\\)"
3808 "[[:space:]]+\\([[:digit:]]+\\)")) 3807 "[[:space:]]+\\([[:digit:]]+\\)"))
3809 (list (string-to-number (concat (match-string 1) "e0")) 3808 (list (string-to-number (match-string 1))
3810 ;; The second value is the used size. We need the 3809 ;; The second value is the used size. We need the
3811 ;; free size. 3810 ;; free size.
3812 (- (string-to-number (concat (match-string 1) "e0")) 3811 (- (string-to-number (match-string 1))
3813 (string-to-number (concat (match-string 2) "e0"))) 3812 (string-to-number (match-string 2)))
3814 (string-to-number (concat (match-string 3) "e0"))))))))) 3813 (string-to-number (match-string 3)))))))))
3815 3814
3816;;; Internal Functions: 3815;;; Internal Functions:
3817 3816
@@ -5159,8 +5158,8 @@ Return ATTR."
5159 (not (string-equal 5158 (not (string-equal
5160 (nth 3 attr) 5159 (nth 3 attr)
5161 (tramp-get-remote-gid vec 'string))))) 5160 (tramp-get-remote-gid vec 'string)))))
5162 ;; Convert inode. 5161 ;; Convert inode. Big numbers have been added to Emacs 27.
5163 (unless (listp (nth 10 attr)) 5162 (unless (or (fboundp 'bignump) (listp (nth 10 attr)))
5164 (setcar (nthcdr 10 attr) 5163 (setcar (nthcdr 10 attr)
5165 (condition-case nil 5164 (condition-case nil
5166 (let ((high (nth 10 attr)) 5165 (let ((high (nth 10 attr))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 335f05cfce0..583acbde03c 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -959,18 +959,15 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
959 (concat "[[:space:]]*\\([[:digit:]]+\\)" 959 (concat "[[:space:]]*\\([[:digit:]]+\\)"
960 " blocks of size \\([[:digit:]]+\\)" 960 " blocks of size \\([[:digit:]]+\\)"
961 "\\. \\([[:digit:]]+\\) blocks available")) 961 "\\. \\([[:digit:]]+\\) blocks available"))
962 (setq blocksize (string-to-number (concat (match-string 2) "e0")) 962 (setq blocksize (string-to-number (match-string 2))
963 total (* blocksize 963 total (* blocksize (string-to-number (match-string 1)))
964 (string-to-number (concat (match-string 1) "e0"))) 964 avail (* blocksize (string-to-number (match-string 3)))))
965 avail (* blocksize
966 (string-to-number (concat (match-string 3) "e0")))))
967 (forward-line) 965 (forward-line)
968 (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)") 966 (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)")
969 ;; The used number of bytes is not part of the result. As 967 ;; The used number of bytes is not part of the result. As
970 ;; side effect, we store it as file property. 968 ;; side effect, we store it as file property.
971 (tramp-set-file-property 969 (tramp-set-file-property
972 v localname "used-bytes" 970 v localname "used-bytes" (string-to-number (match-string 1))))
973 (string-to-number (concat (match-string 1) "e0"))))
974 ;; Result. 971 ;; Result.
975 (when (and total avail) 972 (when (and total avail)
976 (list total (- total avail) avail))))))) 973 (list total (- total avail) avail)))))))