Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong CR/LF behavior in ssh.exe #1256

Closed
DmitryDonetsky opened this issue Sep 25, 2018 · 6 comments
Closed

Wrong CR/LF behavior in ssh.exe #1256

DmitryDonetsky opened this issue Sep 25, 2018 · 6 comments

Comments

@DmitryDonetsky
Copy link

"OpenSSH for Windows" version
7.7.2.0

Server OperatingSystem
FreeBSD 10.4-RELEASE amd64
TERM=cons25r

Client OperatingSystem
Windows 7 x64 russian
TERM=cons25r

What is failing
CR worked as CR+LF, LF are ignored. This leads to multiple output issues in my case.

Background:
The server assumes the historical behavior of the terminal, in which it works as mechanical teletype or typewriter.
One or more of CR should cause the mechanical carriage will be move to the position of the first character of the same line, without scrolling the paper.
Each LF should cause the paper to scroll to the next line, without moving the carriage to anywhere.

Expected output
Server sends 0x0d 0x0d 0x0a and prompt, each time you press Return:
sc1

On exit from Midnight Commander, server sends 0x1b 0x5b 0x4b 0x0a 20+ times, for line by line screen cleaning and move cursor to last line:
sc3

Actual output
Unwanted blank lines:
sc2

The screen is not cleared, prompt is in the second line from upper end:
sc4

@dpsenner
Copy link

dpsenner commented Feb 8, 2019

I'm observing an issue that appears to be related to this one when connecting to a linux machine from windows in a powershell console. I.e. after starting the powershell.exe I observe "user@some-host" to be duplicated on the same line:

PS D:\Workspace> ssh some-host
user@some-host:~$ clear
user@some-host:~$ user@some-host:~$ echo "hello"
hello
user@some-host:~$ clear
user@some-host:~$ user@some-host:~$ <enter>
user@some-host:~$ <enter>
user@some-host:~$ lsb_release -r
Release:        18.04
user@some-host:~$ man clear
(hit <q>)
user@some-host:~$ user@some-host:~$ 

It appears that the way how clear and man attempt to clear the screen does not work out well when done from an ssh shell started in a powershell.

Noteworthy, too, is that with the user@some-host:~$ user@some-host:~$ printed it is enough to resize the powershell window to restore it such that it displays user@some-host:~$ , i.e. by grabbing it with the mouse and increasing or decreasing the width by one column. Decreasing the powershell windows' height does not help, though.

@vsalvino
Copy link

vsalvino commented Mar 2, 2019

I am also seeing the exact issue that dpsenner reported above. Issue is the same regardless of using any combination of CMD, PowerShell 5.1, or PowerShell 6.1 with Win32-OpenSSH client 7.7 or 7.9.

Also interesting, but probably unrelated, is that ssh.exe seems to always change the cursor size to "small" even it if it set as "large" in PowerShell.

@maertendMSFT
Copy link
Collaborator

@DHowett-MSFT , this appears to be a console issue, can you take a look?

@DHowett
Copy link

DHowett commented Aug 24, 2020

This probably has the same root cause as the login/motd duplication issue that was fixed in PowerShell/openssh-portable#426.

@DHowett
Copy link

DHowett commented Aug 24, 2020

Sorry, I was reading the comments #1256 (comment) and #1256 (comment) which are off-topic for this issue. 😬

This cons25r is not something that I have ever seen, and I do not expect that it has the right terminfo/termcap behavior for the Windows Console.

At the same time, when Win32-OpenSSH is running on windows 7, it does a significant amount of preprocessing before sending output to the console. I'd start debugging there 😄

@bagajjal
Copy link
Collaborator

For Windows 7, we support only VT100.
From windows10, we have full xterm support from the windows console team.

We are not investing to fix bugs in VT100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants