Commit adcf904b authored by Michael Albinus's avatar Michael Albinus

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.
parent d77d01d2
......@@ -265,12 +265,12 @@ pass to the OPERATION."
"[[:space:]]+\\([[:digit:]]+\\)"))
;; The values are given as 1k numbers, so we must change
;; them to number of bytes.
(list (* 1024 (string-to-number (concat (match-string 1) "e0")))
(list (* 1024 (string-to-number (match-string 1)))
;; The second value is the used size. We need the
;; free size.
(* 1024 (- (string-to-number (concat (match-string 1) "e0"))
(string-to-number (concat (match-string 2) "e0"))))
(* 1024 (string-to-number (concat (match-string 3) "e0")))))))))
(* 1024 (- (string-to-number (match-string 1))
(string-to-number (match-string 2))))
(* 1024 (string-to-number (match-string 3)))))))))
;; This is derived from `tramp-sh-handle-file-truename'. Maybe the
;; code could be shared?
......
......@@ -1273,10 +1273,9 @@ file-notify events."
(used (cdr (assoc "filesystem::used" attr)))
(free (cdr (assoc "filesystem::free" attr))))
(when (and (stringp size) (stringp used) (stringp free))
(list (string-to-number (concat size "e0"))
(- (string-to-number (concat size "e0"))
(string-to-number (concat used "e0")))
(string-to-number (concat free "e0")))))))
(list (string-to-number size)
(- (string-to-number size) (string-to-number used))
(string-to-number free))))))
(defun tramp-gvfs-handle-file-writable-p (filename)
"Like `file-writable-p' for Tramp files."
......
......@@ -694,7 +694,7 @@ else
$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 . %%u) -1)\\n\",
\"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
$type,
$stat[3],
$uid,
......@@ -707,8 +707,7 @@ printf(
$stat[10] & 0xffff,
$stat[7],
$stat[2],
$stat[1] >> 16 & 0xffff,
$stat[1] & 0xffff
$stat[1]
);' \"$1\" \"$2\" 2>/dev/null"
"Perl script to produce output suitable for use with `file-attributes'
on the remote file system.
......@@ -1393,7 +1392,7 @@ component is used as the target of the symlink."
;; `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 %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 -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)
......@@ -1402,9 +1401,9 @@ component is used as the target of the symlink."
(tramp-get-remote-stat vec)
tramp-stat-marker tramp-stat-marker
(if (eq id-format 'integer)
"%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker))
"%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
(if (eq id-format 'integer)
"%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker))
"%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
tramp-stat-marker tramp-stat-marker
(tramp-shell-quote-argument localname)
tramp-stat-quoted-marker)))
......@@ -1825,7 +1824,7 @@ be non-negative integers."
;; make a proper shell escape of them in file names.
"cd %s && echo \"(\"; (%s %s -a | "
"xargs %s -c "
"'(%s%%n%s (%s%%N%s) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 -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)
......@@ -1836,9 +1835,9 @@ be non-negative integers."
tramp-stat-marker tramp-stat-marker
tramp-stat-marker tramp-stat-marker
(if (eq id-format 'integer)
"%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker))
"%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
(if (eq id-format 'integer)
"%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker))
"%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
tramp-stat-marker tramp-stat-marker
tramp-stat-quoted-marker)))
......@@ -3806,12 +3805,12 @@ file-notify events."
(concat "[[:space:]]*\\([[:digit:]]+\\)"
"[[:space:]]+\\([[:digit:]]+\\)"
"[[:space:]]+\\([[:digit:]]+\\)"))
(list (string-to-number (concat (match-string 1) "e0"))
(list (string-to-number (match-string 1))
;; The second value is the used size. We need the
;; free size.
(- (string-to-number (concat (match-string 1) "e0"))
(string-to-number (concat (match-string 2) "e0")))
(string-to-number (concat (match-string 3) "e0")))))))))
(- (string-to-number (match-string 1))
(string-to-number (match-string 2)))
(string-to-number (match-string 3)))))))))
;;; Internal Functions:
......@@ -5159,8 +5158,8 @@ Return ATTR."
(not (string-equal
(nth 3 attr)
(tramp-get-remote-gid vec 'string)))))
;; Convert inode.
(unless (listp (nth 10 attr))
;; Convert inode. Big numbers have been added to Emacs 27.
(unless (or (fboundp 'bignump) (listp (nth 10 attr)))
(setcar (nthcdr 10 attr)
(condition-case nil
(let ((high (nth 10 attr))
......
......@@ -959,18 +959,15 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(concat "[[:space:]]*\\([[:digit:]]+\\)"
" blocks of size \\([[:digit:]]+\\)"
"\\. \\([[:digit:]]+\\) blocks available"))
(setq blocksize (string-to-number (concat (match-string 2) "e0"))
total (* blocksize
(string-to-number (concat (match-string 1) "e0")))
avail (* blocksize
(string-to-number (concat (match-string 3) "e0")))))
(setq blocksize (string-to-number (match-string 2))
total (* blocksize (string-to-number (match-string 1)))
avail (* blocksize (string-to-number (match-string 3)))))
(forward-line)
(when (looking-at "Total number of bytes: \\([[:digit:]]+\\)")
;; The used number of bytes is not part of the result. As
;; side effect, we store it as file property.
(tramp-set-file-property
v localname "used-bytes"
(string-to-number (concat (match-string 1) "e0"))))
v localname "used-bytes" (string-to-number (match-string 1))))
;; Result.
(when (and total avail)
(list total (- total avail) avail)))))))
......
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