Subject: bug#65551: 29.1; Eshell on MS-Windows using plink: 'plink' is not recognized as an internal or external command...

From: Michael Albinus <[email-masked]>
Date: Mon, 28 Aug 2023 19:33:30 +0200

Jim Porter <[email-masked]> writes:

Hi Jim,

> On 8/28/2023 9:29 AM, Jim Porter wrote:
>> On 8/28/2023 3:27 AM, Michael Albinus wrote:
>>> I've applied the following sledge-hammer patch, which cures the problem
>>> for me. But I'm pretty sure there are better ways in Eshell to fix this.
>> How about something like this? It's a little less invasive (but no
>> less of a hack).
>
> Oops, something more like this (let-binding 'tramp-remote-path').

Might work. But well, it is Tramp. Everything is more complex.

tramp-remote-path is just a template, It is taken the very first time
you connect to a remote host in order to determine proper PATH
settings. The result is cached in the connection property "remote-path".

Every new process for that remote host (like returned by make-process)
checks first, whether this connection property exists, and uses it. Only
if the connection property doesn't exist, it is recomputed starting with
tramp-remote-path.

So usually, you don't have to do anything wrt PATH. That's why my
sledge-hammer patch works.

If a user changes PATH for a remote connection in eshell (I don't recall
how, but I'm sure it is possible in Eshell), you just have to change the
respective connection property "remote-path" in Tramp.
See (info "(tramp) Predefined connection information")

There is an exception: If a user has the symbol tramp-own-remote-path
in tramp-remote-path, the cached value is not used for a new process,
and PATH is recomputed based on tramp-remote-path.

Writing this, it sounds to me too complex. OTOH, no other package has
tried yet to play with the remote PATH. There are bug reports by users
who request a simplification (bug#61926, bug#62326). Perhaps it is time
to redesign the machinery in Tramp.

Best regards, Michael.