Subject: Re: bug#72450: 29.1; Tramp Failed to Parse OS Name and Version for Windows 11

From: Eli Zaretskii <[email-masked]>
Date: Sun, 04 Aug 2024 07:41:32 +0300

> From: Duncan Greatwood <[email-masked]>
> Date: Sat, 3 Aug 2024 12:54:01 -0700
> 
> I am seeing the following error from Tramp:
> tramp-error: ‘echo \"`uname -sr`\"’ does not return a valid Lisp expression: ‘"MSYS_NT-10.0-22631
> 3.4.10-87d57229.x86_64" [17;120H’
> 
> Background:
> 
> I have a "Windows 11 Home Edition" remote machine, and am seeking to connect to that machine from emacs
> run on macOS.
> 
> In emacs, I am doing:
> (find-file "/ssh:WINUSERNAME@WIN11HOME:WINPATH")
> with suitable values for WINUSERNAME, WIN11HOME, WINPATH.
> 
> I can ssh to WIN11HOME (it is running the OpenSSH Server), using keys stored locally in my macOS.
> 
> By default, the shell produced for the ssh to windows is a PowerShell, which I can well understand is not what
> Tramp expects; Tramp was producing an error "Couldn't find remote shell prompt for /bin/sh". 
> 
> To address, now I detect the tramp attach on the Windows side and, in the Tramp case, move to shell "sh" for
> the Windows prompt.
> 
> Thereafter, tramp produces the "uname/lisp" error above.
> 
> FYI, from the windows side:
>     sh-5.2$ uname -sr
>     MSYS_NT-10.0-22631 3.4.10-87d57229.x86_64

My suggestion is not to have the MSYS 'uname' on your Path.  I think
it gets in the way, and Tramp doesn't really need it on Windows.

Michael, am I right?

In general, too many Windows users of Emacs install MSYS in a way that
its utilities are on the system-wide Path, without understanding the
caveats and subtle issues this could cause.