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: Sun, 27 Aug 2023 19:50:44 +0200

Jordan Wilson <[email-masked]> writes:

> Hi all,

Hi Jordan & Jim,

> I've found a bug in Eshell on MS-Windows on 29.1. This is a regression
> from 28.2. When connected to a remote machine using putty's "plink",
> using any commands on the remote machine (e.g. not built-in to eshell)
> prints this error in the eshell buffer (details replaced):
>
> plink -l username -ssh -t example.com " env 'TERM=dumb'
> 'PROMPT_COMMAND=' 'PS1=#$ ' /bin/sh -i " ** exit || exit
> 'plink' is not recognised as an internal or external command, operable
> program or batch file.
>
> Recipe, starting from "emacs -Q":
> 1) open eshell
> 2) connect to a remote host using plink
> - cd /plink:[email-masked]:/home/username/
> 3) ./test.sh (executable script)
> or...
> 3) *ls
> or...
> 3) (any remote command not built-in into Emacs)
>
> Below is the backtrace produced from this (using
> `toggle-debug-on-error') again with details replaced.

First I try to understand the scenario Eshell is using. If Eshell has
changed to a remote directory, and a command like "./test.sh" is called,
I would expect a synchronous process. But this doesn't seem to be the case:

>   tramp-file-name-handler(make-process :name "test.sh" :buffer #<killed buffer> :command ("/home/username/test.sh") :filter eshell-output-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)
>   eshell-gather-process-output("/plink:[email-masked]:/home/username/test.s..." nil)
>   eshell-external-command("./test.sh" nil)

`make-process' is called, an asynchronous process. Is this intended? Has
this been changed since Emacs 28?

Second, I've played a little bit on MS Windows. I haven't installed
Emacs 29 there, just an Emacs git master checkout. And plink is not in
the PATH of my MINGW64 bash shell, so I'm using sshx. But everything
works under this constellation:

--8<---------------cut here---------------start------------->8---
Welcome to the Emacs shell

~ $ *hostname
win10
~ $ *uname -sr
MINGW64_NT-10.0-19045 3.2.0-340.x86_64
~ $ cd /sshx:detlef.fritz.box:
/sshx:detlef.fritz.box:~ $ *hostname
detlef
/sshx:detlef.fritz.box:~ $ *uname -sr
Linux 6.2.0-27-generic
/sshx:detlef.fritz.box:~ $ which hostname
/sshx:detlef.fritz.box://usr/bin/hostname
/sshx:detlef.fritz.box:~ $ *which hostname
/usr/bin/hostname
/sshx:detlef.fritz.box:~ $
--8<---------------cut here---------------end--------------->8---

> Thanks,
> Jordan.

Best regards, Michael.