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

From: Duncan Greatwood <[email-masked]>
Date: Wed, 7 Aug 2024 14:46:29 -0700

Thank you for reviewing the file.

Re:

> [?25l[2J[m[Hsh-5.2$[1C]0;C:\Windows\system32\conhost.exe [?25h

The actual prompt that appears on the screen is:
sh-5.2$

Please note that "C:\Windows\system32\conhost.exe" is not a prompt, it is
not output as text on the terminal, it is the "job name" that Windows
provides. (FYI, conhost.exe is the core Windows process that provides any
prompt, whether PowerShell, command prompt, or bash/sh).

As a point of comparison, when I ssh to a Linux machine the "job name" is
simply ssh.

I don't know why the string emacs-tramp is seeing as the prompt appears to
include the job name and those control characters. I have looked on client
side and server side, and don't see a way of suppressing/changing the job
name in Window's OpenSSH, nor the control characters either.

I tried it in iTerm and in Terminal. I tried it from macOS (with ssh proxy)
and from Linux (no proxy). All the same failure.

Unless there can be different handling in respect of the job name, I don't
see an approach to use ssh to access the windows box with tramp.

Unless you have any other suggestions :-)
Thanks again.

On Tue, Aug 6, 2024 at 12:41 AM Michael Albinus <[email-masked]>
wrote:

> Duncan Greatwood <[email-masked]> writes:
>
> Hi Duncan,
>
> > Then I used the normal tramp /ssh:... form to open LINUX-MOUNT-DIR and
> > then open a file contained on the mount. I.e. With emacs running on
> > macOS, this is going macOS -> (ssh) -> Linux -> (smb) -> Windows. And
> > it seems to work just as you'd hope.
>
> Good to know that you have a working solution.
>
> >     Set tramp-verbose to 6 in a new Emacs session, prior the ssh
> >     connection. When it has failed, there is a *debug tramp/ssh ...*
> >     buffer; please send it as attachment.
> >
> > [DG] Firstly, my apologies - I can't recreate the "uname parsing
> > issue" directly now. Instead, emacs will go to a time out trying to
> > access the Windows machine via the ssh proxy. I don't know what's
> > changed.
> >
> > In any case, I am enclosing the debug output file. It is 86MB, so I am
> > sharing via Google Drive, hopefully that's OK.
> >
> https://drive.google.com/file/d/1aH1c-58rfOmjKVBqqfJ9QpzY5m-ltmDQ/view?usp=sharing
> >
> > This is with the Windows machine using /usr/bin/sh as the default
> > shell for ssh login. Confirmed at the client command prompt - if I do
> > "ssh WINDOWS", I log in and get the "sh" prompt.
>
> According to the debug file, Tramp is blocked now at an earlier
> stage. From your proxy host, it sends
>
> --8<---------------cut here---------------start------------->8---
> 14:52:19.860849 tramp-send-command (6) # exec ssh -l dgrea -o
> ControlMaster=auto -o ControlPath=tramp.%C -o ControlPersist=no -e none
> WIN11_1HM
> --8<---------------cut here---------------end--------------->8---
>
> In its working buffer, it sees then after a timeout of one minute
>
> --8<---------------cut here---------------start------------->8---
> 14:53:19.871637 tramp-process-actions (1) # File error: Timeout reached,
> see buffer ‘*tramp/ssh dgrea@WIN11_1HM*’ for details
> tput: No value for $TERM and no -T specified
> tput: No value for $TERM and no -T specified
> [?25l[2J[m[Hsh-5.2$[1C]0;C:\Windows\system32\conhost.exe [?25h
> --8<---------------cut here---------------end--------------->8---
>
> The tput warnings can be ignored. But the last line is the shell prompt
> offered to Tramp. It doesn't understand it.
>
> Please read the Tramp manual, how to simplify the prompt in order to let
> Tramp understand it. Escape sequences and a (Windows-syntax) path are
> good to confuse Tramp.
>
> Best regards, Michael.
>

-- 
NOTICE: This email and its attachments may contain privileged and 
confidential information, only for the viewing and use of the intended 
recipient. If you are not the intended recipient, you are hereby notified 
that any disclosure, copying, distribution, acting upon, or use of the 
information contained in this email and its attachments is strictly 
prohibited and that this email and its attachments must be immediately 
returned to the sender and deleted from your system. If you received this 
email erroneously, please notify the sender immediately.  Xage Security, 
Inc. and its affiliates will never request personal information (e.g., 
passwords, Social Security numbers) via email.  Report suspicious emails to 
[email-masked] <mailto:[email-masked]>