Commit 3fa8bdca authored by Michael Albinus's avatar Michael Albinus
Browse files

* lisp/net/tramp-sh.el (tramp-set-remote-path): Send a warning, if

$PATH exceeds PATH_MAX on the remote system.
parent 5d625851
Pipeline #331 failed with stage
in 2 seconds
......@@ -3885,10 +3885,22 @@ This function expects to be in the right *tramp* buffer."
I.e., for each directory in `tramp-remote-path', it is tested
whether it exists and if so, it is added to the environment
variable PATH."
(let ((path (mapconcat 'identity (tramp-get-remote-path vec) ":"))
(with-tramp-connection-property vec "path-max"
(tramp-send-command-and-read vec "getconf PATH_MAX /")))
(tramp-message vec 5 "Setting $PATH environment variable")
vec (format "PATH=%s; export PATH"
(mapconcat 'identity (tramp-get-remote-path vec) ":"))))
(unless (< (length path) path-max)
(setq index path-max)
(while (not (string-equal (substring path (1- index) index) ":"))
(setq index (1- index)))
;; FIXME: Is this sufficient? Or shall we raise an error?
vec 2 "$PATH environment variable is too long. Ignoring \"%s\""
(substring path index))
(setq path (substring path 0 (1- index))))
(tramp-send-command vec (format "PATH=%s; export PATH" path))))
;; ------------------------------------------------------------
;; -- Communication with external shell --
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