diff options
| -rw-r--r-- | lisp/net/tramp-sh.el | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 022ecb3d790..5c9c568545c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3817,22 +3817,26 @@ file-notify events." | |||
| 3817 | (tramp-message v 5 "file system info: %s" localname) | 3817 | (tramp-message v 5 "file system info: %s" localname) |
| 3818 | (tramp-send-command | 3818 | (tramp-send-command |
| 3819 | v (format | 3819 | v (format |
| 3820 | "%s --block-size=1 --output=size,used,avail %s" | 3820 | "%s %s" |
| 3821 | (tramp-get-remote-df v) (tramp-shell-quote-argument localname))) | 3821 | (tramp-get-remote-df v) (tramp-shell-quote-argument localname))) |
| 3822 | (with-current-buffer (tramp-get-connection-buffer v) | 3822 | (with-current-buffer (tramp-get-connection-buffer v) |
| 3823 | (goto-char (point-min)) | 3823 | (goto-char (point-min)) |
| 3824 | (forward-line) | 3824 | (forward-line) |
| 3825 | (when (looking-at | 3825 | (when (looking-at |
| 3826 | (eval-when-compile | 3826 | (eval-when-compile |
| 3827 | (concat "[[:space:]]*\\([[:digit:]]+\\)" | 3827 | (concat "\\(?:^/[^[:space:]]*[[:space:]]\\)?" |
| 3828 | "[[:space:]]*\\([[:digit:]]+\\)" | ||
| 3828 | "[[:space:]]+\\([[:digit:]]+\\)" | 3829 | "[[:space:]]+\\([[:digit:]]+\\)" |
| 3829 | "[[:space:]]+\\([[:digit:]]+\\)"))) | 3830 | "[[:space:]]+\\([[:digit:]]+\\)"))) |
| 3830 | (list (string-to-number (match-string 1)) | 3831 | (mapcar |
| 3831 | ;; The second value is the used size. We need the | 3832 | (lambda (d) |
| 3832 | ;; free size. | 3833 | (* d (tramp-get-connection-property v "df-blocksize" 0))) |
| 3833 | (- (string-to-number (match-string 1)) | 3834 | (list (string-to-number (match-string 1)) |
| 3834 | (string-to-number (match-string 2))) | 3835 | ;; The second value is the used size. We need the |
| 3835 | (string-to-number (match-string 3))))))))) | 3836 | ;; free size. |
| 3837 | (- (string-to-number (match-string 1)) | ||
| 3838 | (string-to-number (match-string 2))) | ||
| 3839 | (string-to-number (match-string 3)))))))))) | ||
| 3836 | 3840 | ||
| 3837 | ;;; Internal Functions: | 3841 | ;;; Internal Functions: |
| 3838 | 3842 | ||
| @@ -5578,12 +5582,24 @@ This command is returned only if `delete-by-moving-to-trash' is non-nil." | |||
| 5578 | "Determine remote `df' command." | 5582 | "Determine remote `df' command." |
| 5579 | (with-tramp-connection-property vec "df" | 5583 | (with-tramp-connection-property vec "df" |
| 5580 | (tramp-message vec 5 "Finding a suitable `df' command") | 5584 | (tramp-message vec 5 "Finding a suitable `df' command") |
| 5581 | (let ((result (tramp-find-executable vec "df" (tramp-get-remote-path vec)))) | 5585 | (let ((df (tramp-find-executable vec "df" (tramp-get-remote-path vec))) |
| 5582 | (and | 5586 | result) |
| 5583 | result | 5587 | (when df |
| 5584 | (tramp-send-command-and-check | 5588 | (cond |
| 5585 | vec (format "%s --block-size=1 --output=size,used,avail /" result)) | 5589 | ;; coreutils. |
| 5586 | result)))) | 5590 | ((tramp-send-command-and-check |
| 5591 | vec | ||
| 5592 | (format | ||
| 5593 | "%s /" | ||
| 5594 | (setq result | ||
| 5595 | (format "%s --block-size=1 --output=size,used,avail" df)))) | ||
| 5596 | (tramp-set-connection-property vec "df-blocksize" 1) | ||
| 5597 | result) | ||
| 5598 | ;; POSIX.1 | ||
| 5599 | ((tramp-send-command-and-check | ||
| 5600 | vec (format "%s /" (setq result (format "%s -k" df)))) | ||
| 5601 | (tramp-set-connection-property vec "df-blocksize" 1024) | ||
| 5602 | result)))))) | ||
| 5587 | 5603 | ||
| 5588 | (defun tramp-get-remote-gio-monitor (vec) | 5604 | (defun tramp-get-remote-gio-monitor (vec) |
| 5589 | "Determine remote `gio-monitor' command." | 5605 | "Determine remote `gio-monitor' command." |