Skip to content

Wrong CR/LF behavior in ssh.exe #1256

Closed

Description

@DmitryDonetsky

"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

Activity

  1. dpsenner commented on Feb 8, 2019

    @dpsenner

    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.

  2. vsalvino commented on Mar 2, 2019

    @vsalvino

    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.

  3. maertendMSFT commented on Jul 16, 2020

    @maertendMSFT
    Collaborator

    Dustin L. Howett (MSFT) (@DHowett-MSFT) , this appears to be a console issue, can you take a look?

  4. DHowett commented on Aug 24, 2020

    @DHowett

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

  5. DHowett commented on Aug 24, 2020

    @DHowett

    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 😄

  6. bagajjal commented on Mar 30, 2021

    @bagajjal
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions