diff options
| author | Michael Albinus <michael.albinus@gmx.de> | 2018-12-19 20:29:29 +0100 |
|---|---|---|
| committer | Michael Albinus <michael.albinus@gmx.de> | 2018-12-19 20:29:29 +0100 |
| commit | 3fa8bdca88153ff442ca22d8c298525c1b716e7e (patch) | |
| tree | a021a730b9ad8a71b360ce10a841a9171fedbd52 | |
| parent | 5d6258518e4ba5312fc7d6564bba2232e06bf0a6 (diff) | |
| download | emacs-3fa8bdca88153ff442ca22d8c298525c1b716e7e.tar.gz | |
* 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.el | 20 |
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." 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." - (tramp-message vec 5 "Setting $PATH environment variable") - (tramp-send-command - vec (format "PATH=%s; export PATH" - (mapconcat 'identity (tramp-get-remote-path vec) ":")))) + (let ((path (mapconcat 'identity (tramp-get-remote-path vec) ":")) + (path-max + (with-tramp-connection-property vec "path-max" + (tramp-send-command-and-read vec "getconf PATH_MAX /"))) + index) + (tramp-message vec 5 "Setting $PATH environment variable") + (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? + (tramp-message + 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 -- |
