Subject: Re: bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integration loaded

From: Michael Albinus <[email-masked]>
Date: Sun, 18 Sep 2022 13:18:37 +0200

Colton Lewis via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

Hi Colton,

> 1. Create an executable script ~/test-bin/test.sh
> 2. emacs -Q -l tramp-integration
> 3. Eval the elisp snippet:
> `(setenv "PATH" (concat (expand-file-name "~/test-bin") ":" (getenv
> "PATH")))`
> 4. Start eshell
> 5. test.sh
> 6. Observe command not found error

I've fixed this in the emacs-28 branch of the git repository, will be
merged to the master branch next days. Do yo have a chance to test? As
reference, I've appended the patch.

It isn't known yet whether there will be another Emacs 28 release, so
this change will appear in either Emacs 28.3 or 29.1. But you don't need
to wait that long, the next Tramp 2.5.3.3 release on GNU ELPA will carry
this patch as well.

Best regards, Michael.

*** /tmp/ediffO8DSK8	2022-09-18 13:16:26.974594555 +0200
--- /home/albinus/src/emacs-28/lisp/net/tramp-integration.el	2022-09-18 12:05:50.293303445 +0200
***************
*** 134,141 ****
    ;; Remove last element of `(exec-path)', which is `exec-directory'.
    ;; Use `path-separator' as it does eshell.
    (setq eshell-path-env
! 	(mapconcat
! 	 #'identity (butlast (tramp-compat-exec-path)) path-separator)))

  (with-eval-after-load 'esh-util
    (add-hook 'eshell-mode-hook
--- 134,143 ----
    ;; Remove last element of `(exec-path)', which is `exec-directory'.
    ;; Use `path-separator' as it does eshell.
    (setq eshell-path-env
!         (if (file-remote-p default-directory)
!             (mapconcat
! 	     #'identity (butlast (tramp-compat-exec-path)) path-separator)
!           (getenv "PATH"))))

  (with-eval-after-load 'esh-util
    (add-hook 'eshell-mode-hook