diff options
| author | Michael Albinus | 2019-07-13 13:33:10 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-07-13 13:33:10 +0200 |
| commit | 4c4fcc51afa9d2a6b4223a9949240b700d3284e8 (patch) | |
| tree | 969a09323d9e80f79b24396a87ff12032d49d9e3 | |
| parent | 9939e04404b3d7621a9fd260c977ff5c7a0fb0d0 (diff) | |
| download | emacs-4c4fcc51afa9d2a6b4223a9949240b700d3284e8.tar.gz emacs-4c4fcc51afa9d2a6b4223a9949240b700d3284e8.zip | |
Make check for compression programs more robust in Tramp
* lisp/net/tramp-sh.el (tramp-inline-compress-start-size):
Revert change of init value. We fix this differently.
(tramp-find-inline-compress): Check also the output of the
processes, not only the return code.
| -rw-r--r-- | lisp/net/tramp-sh.el | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 63c1bf48f51..bebe2c2d334 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -38,14 +38,13 @@ | |||
| 38 | (defvar vc-hg-program) | 38 | (defvar vc-hg-program) |
| 39 | 39 | ||
| 40 | ;;;###tramp-autoload | 40 | ;;;###tramp-autoload |
| 41 | (defcustom tramp-inline-compress-start-size | 41 | (defcustom tramp-inline-compress-start-size 4096 |
| 42 | (unless (memq system-type '(windows-nt)) 4096) | ||
| 43 | "The minimum size of compressing where inline transfer. | 42 | "The minimum size of compressing where inline transfer. |
| 44 | When inline transfer, compress transferred data of file | 43 | When inline transfer, compress transferred data of file whose |
| 45 | whose size is this value or above (up to `tramp-copy-size-limit'). | 44 | size is this value or above (up to `tramp-copy-size-limit' for |
| 45 | out-of-band methods). | ||
| 46 | If it is nil, no compression at all will be applied." | 46 | If it is nil, no compression at all will be applied." |
| 47 | :group 'tramp | 47 | :group 'tramp |
| 48 | :version "26.3" | ||
| 49 | :type '(choice (const nil) integer)) | 48 | :type '(choice (const nil) integer)) |
| 50 | 49 | ||
| 51 | ;;;###tramp-autoload | 50 | ;;;###tramp-autoload |
| @@ -4557,30 +4556,38 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4557 | vec 5 | 4556 | vec 5 |
| 4558 | "Checking local compress commands `%s', `%s' for sanity" | 4557 | "Checking local compress commands `%s', `%s' for sanity" |
| 4559 | compress decompress) | 4558 | compress decompress) |
| 4560 | (unless | 4559 | (with-temp-buffer |
| 4561 | (zerop | 4560 | (unless |
| 4562 | (tramp-call-local-coding-command | 4561 | (and |
| 4563 | (format | 4562 | (zerop |
| 4564 | "echo %s | %s | %s" magic | 4563 | (tramp-call-local-coding-command |
| 4565 | ;; Windows shells need the program file name after | 4564 | (format |
| 4566 | ;; the pipe symbol be quoted if they use forward | 4565 | "echo %s | %s | %s" magic |
| 4567 | ;; slashes as directory separators. | 4566 | ;; Windows shells need the program file name after |
| 4568 | (mapconcat | 4567 | ;; the pipe symbol be quoted if they use forward |
| 4569 | #'tramp-unquote-shell-quote-argument | 4568 | ;; slashes as directory separators. |
| 4570 | (split-string compress) " ") | 4569 | (mapconcat |
| 4571 | (mapconcat | 4570 | #'tramp-unquote-shell-quote-argument |
| 4572 | #'tramp-unquote-shell-quote-argument | 4571 | (split-string compress) " ") |
| 4573 | (split-string decompress) " ")) | 4572 | (mapconcat |
| 4574 | nil nil)) | 4573 | #'tramp-unquote-shell-quote-argument |
| 4575 | (throw 'next nil)) | 4574 | (split-string decompress) " ")) |
| 4576 | (tramp-message | 4575 | nil t)) |
| 4576 | (string-match | ||
| 4577 | (concat "^" (regexp-quote magic) "$") (buffer-string))) | ||
| 4578 | (throw 'next nil))) | ||
| 4579 | (tramp-message | ||
| 4577 | vec 5 | 4580 | vec 5 |
| 4578 | "Checking remote compress commands `%s', `%s' for sanity" | 4581 | "Checking remote compress commands `%s', `%s' for sanity" |
| 4579 | compress decompress) | 4582 | compress decompress) |
| 4580 | (unless (tramp-send-command-and-check | 4583 | (unless (tramp-send-command-and-check |
| 4581 | vec (format "echo %s | %s | %s" magic compress decompress) t) | 4584 | vec (format "echo %s | %s | %s" magic compress decompress) t) |
| 4582 | (throw 'next nil)) | 4585 | (throw 'next nil)) |
| 4583 | (setq found t))) | 4586 | (with-current-buffer (tramp-get-buffer vec) |
| 4587 | (goto-char (point-min)) | ||
| 4588 | (unless (looking-at (regexp-quote magic)) | ||
| 4589 | (throw 'next nil))) | ||
| 4590 | (setq found t))) | ||
| 4584 | 4591 | ||
| 4585 | ;; Did we find something? | 4592 | ;; Did we find something? |
| 4586 | (if found | 4593 | (if found |