aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2018-12-19 20:29:29 +0100
committerMichael Albinus2018-12-19 20:29:29 +0100
commit3fa8bdca88153ff442ca22d8c298525c1b716e7e (patch)
treea021a730b9ad8a71b360ce10a841a9171fedbd52
parent5d6258518e4ba5312fc7d6564bba2232e06bf0a6 (diff)
downloademacs-3fa8bdca88153ff442ca22d8c298525c1b716e7e.tar.gz
emacs-3fa8bdca88153ff442ca22d8c298525c1b716e7e.zip
* lisp/net/tramp-sh.el (tramp-set-remote-path): Send a warning, if
$PATH exceeds PATH_MAX on the remote system.
-rw-r--r--lisp/net/tramp-sh.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e4ec735a96c..14ae2cb51b4 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3885,10 +3885,22 @@ This function expects to be in the right *tramp* buffer."
3885I.e., for each directory in `tramp-remote-path', it is tested 3885I.e., for each directory in `tramp-remote-path', it is tested
3886whether it exists and if so, it is added to the environment 3886whether it exists and if so, it is added to the environment
3887variable PATH." 3887variable PATH."
3888 (tramp-message vec 5 "Setting $PATH environment variable") 3888 (let ((path (mapconcat 'identity (tramp-get-remote-path vec) ":"))
3889 (tramp-send-command 3889 (path-max
3890 vec (format "PATH=%s; export PATH" 3890 (with-tramp-connection-property vec "path-max"
3891 (mapconcat 'identity (tramp-get-remote-path vec) ":")))) 3891 (tramp-send-command-and-read vec "getconf PATH_MAX /")))
3892 index)
3893 (tramp-message vec 5 "Setting $PATH environment variable")
3894 (unless (< (length path) path-max)
3895 (setq index path-max)
3896 (while (not (string-equal (substring path (1- index) index) ":"))
3897 (setq index (1- index)))
3898 ;; FIXME: Is this sufficient? Or shall we raise an error?
3899 (tramp-message
3900 vec 2 "$PATH environment variable is too long. Ignoring \"%s\""
3901 (substring path index))
3902 (setq path (substring path 0 (1- index))))
3903 (tramp-send-command vec (format "PATH=%s; export PATH" path))))
3892 3904
3893;; ------------------------------------------------------------ 3905;; ------------------------------------------------------------
3894;; -- Communication with external shell -- 3906;; -- Communication with external shell --