[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 50ea5b8: Fix Tramp bug#42538
From: |
Michael Albinus |
Subject: |
master 50ea5b8: Fix Tramp bug#42538 |
Date: |
Thu, 30 Jul 2020 07:46:29 -0400 (EDT) |
branch: master
commit 50ea5b871dd264e3a7fd6c3977e021f1a365cb5f
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Fix Tramp bug#42538
* lisp/net/tramp-sh.el (tramp-set-remote-path): Send the command
in several chunks if it is too large. (Bug#42538)
---
lisp/net/tramp-sh.el | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 4dc95b1..1a867c3 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4004,22 +4004,28 @@ whether it exists and if so, it is added to the
environment
variable PATH."
(let ((command
(format
- "PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":")))
+ "PATH=%s && export PATH" (string-join (tramp-get-remote-path vec)
":")))
(pipe-buf
(with-tramp-connection-property vec "pipe-buf"
(tramp-send-command-and-read
vec "getconf PIPE_BUF / 2>/dev/null || echo 4096" 'noerror)))
- tmpfile)
+ tmpfile chunk chunksize)
(tramp-message vec 5 "Setting $PATH environment variable")
(if (< (length command) pipe-buf)
(tramp-send-command vec command)
- ;; Use a temporary file.
- (setq tmpfile (tramp-make-tramp-temp-file vec))
- (tramp-send-command vec (format
- "cat >%s <<'%s'\n%s\n%s"
- (tramp-shell-quote-argument tmpfile)
- tramp-end-of-heredoc
- command tramp-end-of-heredoc))
+ ;; Use a temporary file. We cannot use `write-region' because
+ ;; setting the remote path happens in the early connection
+ ;; handshake, and not all external tools are determined yet.
+ (setq command (concat command "\n")
+ tmpfile (tramp-make-tramp-temp-file vec))
+ (while (not (string-empty-p command))
+ (setq chunksize (min (length command) (/ pipe-buf 2))
+ chunk (substring command 0 chunksize)
+ command (substring command chunksize))
+ (tramp-send-command vec (format
+ "echo -n %s >>%s"
+ (tramp-shell-quote-argument chunk)
+ (tramp-shell-quote-argument tmpfile))))
(tramp-send-command vec (format ". %s" tmpfile))
(tramp-send-command vec (format "rm -f %s" tmpfile)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 50ea5b8: Fix Tramp bug#42538,
Michael Albinus <=