microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.34k stars 815 forks source link

Horizontal Lines/Underscores Everywhere #2168

Closed samaursa closed 6 years ago

samaursa commented 7 years ago

Windows build number: 10.0.15063 What's wrong: I see underscores in the bash console

I am not sure what or how this happened, but I see underscores throughout the console window. I tried relaunching, removing my custom settings, changing font, reverting to legacy console and back, but nothing has worked.

image

sunjoong commented 7 years ago

@samaursa - BAC., https://github.com/cbucher/console/issues/105 ?

samaursa commented 7 years ago

@sunjoong Hmm, not the same issue I don't think. My cursor is still visible (blinking) and is not an underscore.

sunjoong commented 7 years ago

@samaursa - Then... what's your TERM and PS1 environment variable?

samaursa commented 7 years ago

Here's my PS1

export PS1="[\e[32m]\w[\e[m][\e[33m]`parse_git_branch`[\e[m] "

I am not familiar with the TERM variable. I deleted my .bash_profile just to see if that caused the issue. After restarting the console, I am greeted with the same horizontal lines without my custom prompt.

sunjoong commented 7 years ago

@samaursa - Your PS1 looks like not to have "\e[4m", underline ansicode, but... I could not set with above command becase of back-quote, so... for making sure...

echo $PS1
echo $TERM

underscore UPDATE: OR... you could delete .bashrc, .bash_profile and .profile also to see.

sunilmut commented 7 years ago

Marking this as a bug in the console.

sunjoong commented 7 years ago

@sunilmut - Well... It would be very hard to reproduce it if this is a bug, I think; I'm not sure it's a bug.

sunilmut commented 7 years ago

@sunjoong - I am not sure if understand I'm not sure it's a bug. How is a console filled with all _ not be a bug? :)

sunjoong commented 7 years ago

@sunilmut - I set PS1 to "\e[4m$ ", meaning underlining but not restore, and clear command to imitate this behavior, but could not reporduce it.

Second thought, it could be a bug because clear does not real clear.

sunilmut commented 7 years ago

Console folks will need to take a look. Adding @zadjii-msft. But, without repro, there may not be much they can do.

sunjoong commented 7 years ago

@sunilmut - Poor Mike will be busy. Hmm... repro of this issue would be hard, but behavior of clear could be considered because that's different from others like msys2.

For @zadjii-msft, I could not reporduce this issue but could imitate with PS1 set to "\e[4m$ " and clear command, and clear has different behavior from msys2. I'm not sure it's a bug or a feature but it could be better to think of it.

samaursa commented 7 years ago

Sorry for not giving an update sooner. I deleted .bash_profile and .bashrc (I do not have a .profile) but the results are the same.

The underscores seem to be a rendering bug in the console because I see it when I run vim as well (the following screenshot is after deleting .bash_profile and .bashrc and relaunching)

image

Unfortunately, this makes the console completely unusable. I was quite excited to try bash on windows, but this makes it hard to use :)

sunjoong commented 7 years ago

@samaursa - Hmm... It looks like more serious thing that I had thought before. You know, I could not reporduce it but could have imitated with PS1 and clear. The idea of that imitation was simple; Make cursor do draw underline but do not restore it with PS1 and fill it with whole screen with clear command. But by PS1 itself, it cannot do that of vi, sorry :(.

I still wonder PS1 and TERM, the results of command echo $PS1 and echo $TERM, but more deep investigation would be needed, I think. Maybe... @zadjii-msft could tell you how to collect to useful informations for them to reproduce it or for you to get over it.

Hmm... You know... there are another why to launch WSL. You look like to open bash shortcut named "Bash on Ubuntu on Windows" in start menu. You could command bash ~ on cmd.exe console. Do they look different? If bash from cmd.exe does not make that behavior, what do properties be different?

And... in the meanwhile, https://github.com/goreliu/wsl-terminal might be a workaround, I hope.

samaursa commented 7 years ago

here's the values with my settings: image

here's the values without my settings: image

Thanks for the alternative terminal suggestion. I tried it out and everything seems great except that it doesn't seem to pick up my .vimrc settings. I tried placing .vimrc in the same folder as the open-wsl.exe file but vim still didn't take any of the settings. Surprisingly enough, it takes on by bash settings perfectly fine from the home ~ folder.

sunjoong commented 7 years ago

@samaursa - So... your TERM is xterm-256color :). And... wsl-terminal looks like not to fill a screen with underscores, but it seems you say there is another problem with vimrc file. Hmm... the position of vimrc file is your home directory and I had never heard about that problem yet but that might be a whole another issue, so... you could raise new one on this or on wsl-terminal if you want to. I think... https://github.com/goreliu/wsl-terminal could be a better place for that vimrc file :).

Now, what's the result from cmd.exe? Did you see the underscores on cmd.exe window? If it not seen on cmd.exe window, did you see that after bash ~ command on cmd.exe window? If it not seen either, compair differences of propery by mouse right click of cmd.exe window and "Bash on Ubuntu on Windows".

UPDATE:

  1. I hit upon the vimrc problem you mentioned might be about colors. If so... mouse right click of wsl-terminal and check options - Terminal - Type; You could change it to xterm-256color.
  2. Wsl-terminal is an another console program, but cmd.exe and bash use a same conhost console program so I want to know wheither properties of bash from cmd.exe and bash console might be different.
sunilmut commented 7 years ago

Adding few other folks from the console side, @bitcrazed, @miniksa

miniksa commented 7 years ago

@samaursa, what mechanism are you using to launch Bash? Are you using a shortcut file or are you launching it from the run box?

If you are launching it from a shortcut in the start menu or pinned to your task bar (or elsewhere), can you please attach the .LNK file binary that represents the shortcut itself?

If you are launching it from the run box or another application, can you please export HKCU\Console from your registry for me and attach it?

sunjoong commented 7 years ago

I guess @samaursa is lauching bash from shortcut because the title bar of their screenshots shows %USERPROFILE%\AppData\Local\lxss\bash.ico icon. So, @miniksa asked "Bash on Ubuntu on Windows.lnk" file in "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" directory, I think.

miniksa commented 7 years ago

Yeah, that is what I was asking. Both pieces of information are actually probably helpful. I'm trying to find if there's an underscore stuck in any of the settings anywhere.

There are some settings embedded in the .LNK file if it is started from there, and the defaults are stored in the registry. Attaching all that information would help me.

bearddotsh commented 7 years ago

I had this exact same problem. Interestingly enough, mine appeared while playing with my ~/.vimrc file and briefly unchecked "Quick Edit" mode. After re-enabling, and reverting my changes, the console was stuck with these lines. Deleting the registry information under HKEY_CURRENT_USER\Console did not help, but launching bash.exe from powershell or C:\Windows\System32\bash.exe or from the run command-- No lines!

The issue does resurface when using the .LNK shortcut in AppData\Roaming\Microsoft\Windows\Start Menu\Programs so I think miniksa is onto something with the shortcut defaults.

miniksa commented 7 years ago

@bardyc Can you give me the .LNK file you are using that repros the issue? I can't release a fix until I have a repro case.

bearddotsh commented 7 years ago

Added. Bash on Ubuntu on Windows.zip

I should clarify that this only happened after configuring the "Powerline." vim plugin and installing the custom fonts. The screenshots from @samaursa shows they are using the same Plugin.

There could easily be an escape sequence improperly handled/terminated from this plugin, though I don't know why/where this would persist across sessions.

sunjoong commented 7 years ago

@bardyc, @miniksa - Oh... that shortcut really makes underscores!! I noticed that use raster font, size undefined. EDIT: But, after setting size and another font on shortcut, underscores are there.

miniksa commented 7 years ago

Thanks @bardyc. I see that there's an embedded underscore fill flag inside that LNK file stuck inside the colors field.

I'm going to poke around and see what I can do about preventing this from getting stuck inside the LNK file or maybe ignoring that flag range when loading from LNK or figuring out perhaps how that got persisted in the LNK in the first place (or some combination of those.)

Your help is much appreciated in narrowing this down!

sunjoong commented 7 years ago

Diff of mine and userscoreing shortcut;

sunjoong@SUNJOONG-DESKTOP /mnt/c/Users/sunjoong/Downloads $ diff -u mine underscore
--- mine        2017-07-08 05:17:43.832706500 +0900
+++ underscore  2017-07-08 05:17:39.896207800 +0900
@@ -1,76 +1,76 @@
-[Filename]:                            ..\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Bash on Ubuntu on Windows.lnk
+[Filename]:                            Bash on Ubuntu on Windows.lnk

 [Header]
 Date created:                          03/18/2017 (20:56:44.822) [UTC]
-Last accessed:                         04/14/2017 (13:20:16.287) [UTC]
-Last modified:                         04/14/2017 (13:20:16.287) [UTC]
+Last accessed:                         06/15/2017 (04:39:25.503) [UTC]
+Last modified:                         06/15/2017 (04:39:25.503) [UTC]
 File size:                             77312 bytes
 File attributes:                       0x00000020      (FILE_ATTRIBUTE_ARCHIVE)
 Icon index:                            0
 ShowWindow value:                      1               (SW_SHOWNORMAL / SW_NORMAL)
 Hot key value:                         0x0000          (None)
-Link flags:                            0x000040ef      (HasLinkTargetIDList, HasLinkInfo, HasName, HasRelativePath, HasArguments, HasIconLocation, IsUnicode, HasExpIcon)
+Link flags:                            0x000060ef      (HasLinkTargetIDList, HasLinkInfo, HasName, HasRelativePath, HasArguments, HasIconLocation, IsUnicode, RunAsUser, HasExpIcon)

 [Link Target ID List]
 CLSID:                                 20d04fe0-3aea-1069-a2d8-08002b30309d = My Computer

 Drive:                                 C:\

-Last modified:                         07/01/2017 (02:04:28.0) [UTC]
+Last modified:                         06/15/2017 (04:10:52.0) [UTC]
 Folder attributes:                     0x00000010      (FILE_ATTRIBUTE_DIRECTORY)
 Short directory name:                  Windows
 Date created:                          03/18/2017 (11:40:22.0) [UTC]
-Last accessed:                         07/01/2017 (02:04:28.0) [UTC]
+Last accessed:                         06/15/2017 (04:10:52.0) [UTC]
 Long directory name:                   Windows

-Last modified:                         07/01/2017 (02:04:28.0) [UTC]
+Last modified:                         06/15/2017 (14:04:22.0) [UTC]
 Folder attributes:                     0x00000010      (FILE_ATTRIBUTE_DIRECTORY)
 Short directory name:                  System32
 Date created:                          03/18/2017 (11:40:22.0) [UTC]
-Last accessed:                         07/01/2017 (02:04:28.0) [UTC]
+Last accessed:                         06/15/2017 (14:04:22.0) [UTC]
 Long directory name:                   System32

 File size:                             77312 bytes
-Last modified:                         04/14/2017 (13:20:18.0) [UTC]
+Last modified:                         06/15/2017 (04:39:26.0) [UTC]
 File attributes:                       0x00000020      (FILE_ATTRIBUTE_ARCHIVE)
 8.3 filename:                          bash.exe
 Date created:                          03/18/2017 (20:56:46.0) [UTC]
-Last accessed:                         04/14/2017 (13:20:18.0) [UTC]
+Last accessed:                         06/15/2017 (04:39:26.0) [UTC]
 Long filename:                         bash.exe

 [Link Info]
 Location flags:                                0x00000001      (VolumeIDAndLocalBasePath)
 Drive type:                            3               (DRIVE_FIXED)
-Drive serial number:                   4cfd-bfde
-Volume label (ASCII):
+Drive serial number:                   16de-2f50
+Volume label (ASCII):                  Local Disk
 Local path (ASCII):                    C:\Windows\System32\bash.exe

 [String Data]
 Comment (UNICODE):                     Shortcut to bash.exe
 Relative path (UNICODE):               ..\..\..\..\..\..\..\..\Windows\System32\bash.exe
 Arguments (UNICODE):                   ~
-Icon location (UNICODE):               C:\Users\sunjoong\AppData\Local\lxss\bash.ico
+Icon location (UNICODE):               C:\Users\brady\AppData\Local\lxss\bash.ico

 [Console Properties]
-Color flags:                           0x0007          (FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED)
-Screen buffer width:                   120
-Screen buffer height:                  9001
-Window width:                          120
-Window height:                         30
-Window X coordinate:                   168
-Window Y coordinate:                   189
+Color flags:                           0x8007          (FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED)
+Screen buffer width:                   168
+Screen buffer height:                  61
+Window width:                          168
+Window height:                         46
+Window X coordinate:                   64162
+Window Y coordinate:                   65528
 Font size:                             0 x 16
 Font family value:                     0x00000036      (FF_ROMAN, FF_SWISS, FF_MODERN, FF_DECORATIVE)
 Font weight:                           400             (FW_NORMAL / FW_REGULAR)
-Font face name:                                ???
+Font face name:                                DejaVu Sans Mono for Powerline
 Cursor size:                           25              (Small)
 Fullscreen:                            0               (Disabled)
 QuickEdit mode:                                1               (Enabled)
 Insert mode:                           0               (Disabled)
 Automatic positioning:                 1               (Enabled)
 History buffer size:                   50
-Number of history buffers:             4
-Duplicates allowed in history:         0               (Disabled)
+Number of history buffers:             5
+Duplicates allowed in history:         1               (Enabled)
 Color table values:                    (0x00000000, 0x00800000, 0x00008000, 0x00808000, 0x00000080, 0x00800080, 0x00008080, 0x00c0c0c0, 0x00808080, 0x00ff0000, 0x0000ff00, 0x00ffff00, 0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff)

 [Icon Location]
@@ -84,7 +84,7 @@
 [Metadata Property Store]
 Property set GUID:                     46588ae2-4cbc-4338-bbfc-139326986dce
 ID:                                    4
-Value:                                 0x001f (VT_LPWSTR)      S-1-5-21-3260120242-2150882329-2260907218-1001
+Value:                                 0x001f (VT_LPWSTR)      S-1-5-21-3428738353-1255861482-2546180396-1001

 Property set GUID:                     0c570607-0396-43de-9d61-e321d7df5026
 ID:                                    3
@@ -96,13 +96,13 @@
 ID:                                    4
 Value:                                 0x000b (VT_BOOL)        0x0000 = VARIANT_FALSE
 ID:                                    6
-Value:                                 0x0002 (VT_I2)          0x000000ff = 255
+Value:                                 0x0002 (VT_I2)          0x000000e7 = 231
 ID:                                    5
 Value:                                 0x000b (VT_BOOL)        0xffffffff = VARIANT_TRUE

 Property set GUID:                     446d16b1-8dad-4870-a748-402ea43d788c
 ID:                                    104
-Value:                                 0x0048 (VT_CLSID)       CLSID: 2bd2c32a-0000-0000-0000-501f00000000
+Value:                                 0x0048 (VT_CLSID)       CLSID: f90f13d0-abd1-4a43-8b97-e34f22de1d7e

 [Special Folder Location]
 Special folder identifier:             37              (System)
@@ -110,13 +110,13 @@

 [Distributed Link Tracker Properties]
 Version:                               0
-NetBIOS name:                          sunjoong-deskto
-Droid volume identifier:               fcdccdf0-c33e-4b26-a4b3-2b55bc595e14
-Droid file identifier:                 abe42d7a-5dfa-11e7-91f3-001377c7b4d5
-Birth droid volume identifier:         fcdccdf0-c33e-4b26-a4b3-2b55bc595e14
-Birth droid file identifier:           abe42d7a-5dfa-11e7-91f3-001377c7b4d5
-MAC address:                           00:13:77:c7:b4:d5
-UUID timestamp:                                07/01/2017 (01:14:46.515) [UTC]
-UUID sequence number:                  4595
+NetBIOS name:                          desktop-adcb5v7
+Droid volume identifier:               8dfc0f70-8b73-4207-a7df-5cf4b6753e78
+Droid file identifier:                 ac387935-5184-11e7-b2c2-bc8385dac5c0
+Birth droid volume identifier:         8dfc0f70-8b73-4207-a7df-5cf4b6753e78
+Birth droid file identifier:           ac387935-5184-11e7-b2c2-bc8385dac5c0
+MAC address:                           bc:83:85:da:c5:c0
+UUID timestamp:                                06/15/2017 (04:39:52.500) [UTC]
+UUID sequence number:                  12994

sunjoong@SUNJOONG-DESKTOP /mnt/c/Users/sunjoong/Downloads $
miniksa commented 7 years ago

Yep @sunjoong. It's this line: +Color flags: 0x8007

The 0x8000 is making the underscores. I need to see what I can do about it.

sunjoong commented 7 years ago

@miniksa - Thanks. In the meanwhile, making a new shortcut or launching bash from cmd.exe could be a way if that happens.

bearddotsh commented 7 years ago

After some more testing, I think this color flag is being changed by "Vundle" rather than Powerline. When updating a package, it will draw the underscore as it updates: capture

Hope this helps.

samaursa commented 7 years ago

Sorry for not updating my replies. I can confirm that launching directly from bash.exe fixes the issue. Not sure why launching from the shortcut would fix the issue considering that all the shortcut is doing is making sure we start in ~.

@bardyc you are right, Vundle draws underlines when installing/updating plugins. What's surprising is when I remove all my settings the lines stay.

Having said that, I am back on the command line again and couldn't be happier. Thanks for the help!

miniksa commented 7 years ago

I've submitted a fix for this issue today. It should be out to Insiders in a few weeks.

benhillis commented 7 years ago

Fixed in 16257.

wlisboa commented 7 years ago

I had the same problem and I corrected by changing the background color of the terminal to blue and then to black again.

bitcrazed commented 6 years ago

This issue was moved to Microsoft/console#97