It appears powershell over SSH going to a Windows console is broken strangely. If you use powershell on Windows to ssh and then powershell, you get the last line repeated everytime you press a character. If you use cmd, it basically keeps writing a single line in place rather than ever moving.
Any other linux tool, nano, vim, etc over SSH work fine. So not sure what powershell is doing in particular that the windows powershell terminal cannot handle while handling more complex terminal abusing applications.
Setup for example the "OpenSSH for Windows" or a msys2 ssh implementation (it doesn't matter which one).
Launch powershell on Windows. Execute the ssh client to a debian 8 machine which has powershell installed via the deb packages.
Execute powershell.
Try typing.
It ends up broken like this:
PS /home/mroszko> PS /home/mroszko> $
PS /home/mroszko> $P
PS /home/mroszko> $PS
PS /home/mroszko> $PSV
PS /home/mroszko> $PSVE
PS /home/mroszko> $PSVER
PS /home/mroszko> $PSVERS
PS /home/mroszko> $PSVERSI
PS /home/mroszko> $PSVERSIO
PS /home/mroszko> $PSVERSION
PS /home/mroszko> $PSVERSIONT
PS /home/mroszko> $PSVERSIONTA
PS /home/mroszko> $PSVERSIONTAB
PS /home/mroszko> $PSVERSIONTABL
PS /home/mroszko> $PSVERSIONTABLE
When I was simply trying to type $PSVERSIONTABLE, it automatically kept regenerating the line.
Other strange artifacts can occur instead too, cursor not moving, lines jumping, buffer bleeding.
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-beta.2
OS Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30)
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
What I've tried:
Cmder/Conemu which wrap Cmd.exe and PowerShell.exe
Powershell.exe standalone with OpenSSH for Windows and msys2 ssh separately
Cmd.exe standalone with OpenSSH for Windows and msys2 ssh separately
Uploaded the debug output from Conemu which shows the received characters and escape sequences. (You may have to scroll right to see the entire file if you don't have word wrap)
The last log was from powershell as the windows host.
This log is way way more interesting as its cmd.exe as the windows host and shows all the escape sequences.
ConEmu-2017-06-22-p30324.txt
It starts off with me doing a non-powershell cd, ls and touch. Then I execute powershell and the fun begins.
In powershell there were only two commands executed:
ls -al
exit
@marekr Thanks for your report!
show extreme escape sequence spam
The PowerShell Core supports colors and therefore rewrites the output line after typing every char.
The PowerShell Core supports colors and therefore rewrites the output line after typing every char.
The very vast majority of the escape sequences appear duplicate "Set Attribute mode" to color as red per line. I'm talking a hundred ESC[39;49 m characters if look.
[31;29H[31;1H[39;49m[39;49mP[39;49m[39;49mS[39;49m[39;49m [39;49m[39;49m/[39;49m[39;49mh[39;49m[39;49mo[39;49m[39;49mm[39;49m[39;49me[39;49m[39;49m/[39;49m[39;49mm[39;49m[39;49mr[39;49m[39;49mo[39;49m[39;49ms[39;49m[39;49mz[39;49m[39;49mk[39;49m[39;49mo[39;49m[39;49m/[39;49m[39;49mt[39;49m[39;49me[39;49m[39;49ms[39;49m[39;49mt[39;49m[39;49m>[39;49m[39;49m
Can't the engine be smarter and not call "Set Attribute Mode" per character? I've tested Nano with syntax highlighting, bash with highlighting, etc, they don't spam the control codes like powershell.
Screen cap of the the behavior
Another thing to note, the general performance seems to be very bad just hitting new/line enter.
@lzybkr Could you please comment?
Investing in PSReadline is something I plan to have my team members do for 6.1.0.
I have some work in progress in this area, but this change would probably help a lot - note that I haven't even compiled it and don't have a Linux VM handy, but if someone wants to test it out, feel free.
@lzybkr I tested your change (With a tweak, it won't compile without parenthesis around the -1 defaults) and it does improve the responsiveness of the console alot. The ladder step lines no longer occur either (not that it should have fixed that).
The main benefit its easier to stare at the log file now to further debug. Attached sample.
@marekr - thanks for testing - we'll get this in and hopefully I'll get to the much improved renderer at some point.
@lzybkr no problem
Just to add, there are still some issues where the line isn't incrementing properly upon hitting enter (sparsely) or upon calling powershell from bash when the bash prompt is halfway down the screen, powershell fails to use the upper screen real estate.
@marekr - thanks for testing! If you see other problems - feel free open new Issues - your feedback is very useful!
Most helpful comment
I have some work in progress in this area, but this change would probably help a lot - note that I haven't even compiled it and don't have a Linux VM handy, but if someone wants to test it out, feel free.