I am using Bitvise SSH Server on my Windows machine for remote access. The login shell is ZSH, and I am using Oh My Zsh with it. However, I have also tried BASH and got the same problem. Therefore I guess this problem is with Bitvise SSH Server, not my Cygwin shells or the client-side terminal emulators.
The problem can be noticed on the prompt of my ZSH. As long as my SSH session go through this Bitvise SSH Server, there will be some extra spaces in the prompt. Please see the screenshots:
This windows is the MinTTY on that Windows machine. When I open it you can see there is only one trailing space after ~
(before I type ssh 127.0.0.1
). However once I SSH-ed into the same machine, there are two trailing spaces after ~
in the prompt. Also, if I do another SSH session (to the tiger
machine) within the Bitvise SSH session, the prompt of the second one is also having extra spaces (red underlined prompts). However if I exit from the Bitvise session and SSH to tiger
, directly, the prompt is normal (green underlined prompts).
I observed the same thing when connecting from some remote machine (using gnome-terminal
or xfce4-terminal
as the terminal emulator) to that Windows machine.
Therefore, my conclusion is, the terminal emulator is not to blame for this. The Cygwin and its ZSH are not to blame either, because everything looks good as long as I don't go through Bitvise.
My assumption is there's some special character defined in the Oh My Zsh theme that is not processed correctly when passing through Bitvise. However I couldn't find out what that is exactly. The Oh My Zsh themes look good locally without a Bitvise SSH connection, and they look good on all Linux machines I have. Therefore I think it should be something with Bitvise.
As suggested in the comments, I ran set
in both environments, and got the outputs dumped into two text files: bitvise.txt and local.txt. Now the biggest issue is I cannot compare them using diff
because diff
claims they are binary files (and they differ). I am not sure if this has something to do with the weird spaces.
Forcing LANG
on diff
didn't help.
$ diff -uN bitvise.txt local.txt
Binary files bitvise.txt and local.txt differ
$ LANG=en_US.UTF-8 diff -uN bitvise.txt local.txt
Binary files bitvise.txt and local.txt differ
$ LANG=C diff -uN bitvise.txt local.txt
Binary files bitvise.txt and local.txt differ
The two files are uploaded here: https://drive.google.com/open?id=0B6Pxoys5MF0Bc1d6QUMweUkybHc
Tested some different TERM
settings... Didn't seem to do anything good. Setting TERM=linux
resulted the same with xterm
.
Updated on 5/23/16
The problem seems to be harder than I expected. I found a folder "C:\Program Files\Bitvise SSH Server\TermInfo" which contains the terminal info files. I replaced the files in that folder with the similar files I copied from a normal Ubuntu machine, but didn't help. I also tried the "cygwin" term info that is installed with Cygwin, no luck... Actually the "cygwin" file that comes with Cygwin is the same with the one that comes with Ubuntu...
I run out of idea now.
When I SSH into the Bitvise SSH Server, I can do exec /bin/bash
to replace the current session with Bash. However in that Bash, if I SSH into some other Linux machine that uses Zsh and Oh My Zsh, the same problem persists.
set
to dump the full settings in the several cases. May be you can find a discrepancyset > local.txt
locally and didset > bitvise.txt
in an SSH session tolocalhost
. Now I got the two files, both very big and not exactly the same. Howeverdiff
claims they are binary files so not outputting differences in lines... Still trying to figure out a way for this...man iconv
for conversiondiff
(or too many differences)?LANG=C diff -uN file1 file2
orLANG=en_US.UTF-8 diff -uN file1 file2