aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2025-02-25 09:37:28 +0100
committerMichael Albinus2025-02-25 09:37:28 +0100
commit53eec34da1bf2fb9381680734a99f3fb11225787 (patch)
tree4db2eee9af748f0a3ae0448bc335774a21493ea3
parent41837050181a7cc313f1e9951136f4356601fc4a (diff)
downloademacs-53eec34da1bf2fb9381680734a99f3fb11225787.tar.gz
emacs-53eec34da1bf2fb9381680734a99f3fb11225787.zip
Fix tramp-find-executable
* lisp/net/tramp-sh.el (tramp-find-executable): Use "command -pv", it isbetter supported in different shells. (Bug#76521)
-rw-r--r--lisp/net/tramp-sh.el36
1 files changed, 17 insertions, 19 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 3468ea060d7..2b0df59223a 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4091,25 +4091,23 @@ only in DIRLIST.
4091Returns the absolute file name of PROGNAME, if found, and nil otherwise. 4091Returns the absolute file name of PROGNAME, if found, and nil otherwise.
4092 4092
4093This function expects to be in the right *tramp* buffer." 4093This function expects to be in the right *tramp* buffer."
4094 (with-current-buffer (tramp-get-connection-buffer vec) 4094 (unless ignore-path
4095 (unless ignore-path 4095 (setq dirlist (cons "$PATH" dirlist)))
4096 (setq dirlist (cons "$PATH" dirlist))) 4096 (when ignore-tilde
4097 (when ignore-tilde 4097 ;; Remove all ~/foo directories from dirlist.
4098 ;; Remove all ~/foo directories from dirlist. 4098 (let (newdl d)
4099 (let (newdl d) 4099 (while dirlist
4100 (while dirlist 4100 (setq d (car dirlist)
4101 (setq d (car dirlist) 4101 dirlist (cdr dirlist))
4102 dirlist (cdr dirlist)) 4102 (unless (char-equal ?~ (aref d 0))
4103 (unless (char-equal ?~ (aref d 0)) 4103 (setq newdl (cons d newdl))))
4104 (setq newdl (cons d newdl)))) 4104 (setq dirlist (nreverse newdl))))
4105 (setq dirlist (nreverse newdl)))) 4105 (when (tramp-send-command-and-check
4106 (tramp-send-command 4106 vec (format "(unalias %s; %s command -pv %s)"
4107 vec (format "%s type -P %s 2>%s" 4107 progname
4108 (if dirlist (concat "PATH=" (string-join dirlist ":")) "") 4108 (if dirlist (concat "PATH=" (string-join dirlist ":")) "")
4109 progname (tramp-get-remote-null-device vec))) 4109 progname))
4110 (goto-char (point-min)) 4110 (string-trim (tramp-get-buffer-string (tramp-get-connection-buffer vec)))))
4111 (when (search-forward-regexp "/" nil 'noerror)
4112 (string-trim (buffer-substring (match-beginning 0) (point-max))))))
4113 4111
4114;; On hydra.nixos.org, the $PATH environment variable is too long to 4112;; On hydra.nixos.org, the $PATH environment variable is too long to
4115;; send it. This is likely not due to PATH_MAX, but PIPE_BUF. We 4113;; send it. This is likely not due to PATH_MAX, but PIPE_BUF. We