WSL icon indicating copy to clipboard operation
WSL copied to clipboard

vi/vim.basic does not responds to keyboard input.

Open 0xbadfca11 opened this issue 9 years ago • 48 comments

  • Your Windows build number: (Type ver at a Windows Command Prompt) 16193 Does not occur in 15063 and 16188.

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots) Launch vi does immediately hang. no longer responds. If killed vi process, returned terminal will not responds. But, react to kill -HUP. Does not occur using vim.tiny or vi -u NONE.

  • What's wrong / what should be happening instead: Can edit file.

  • Strace of the failing command, if applicable: (If <cmd> is failing, then run strace -o strace.txt -ff <cmd>, and post the strace.txt output here) https://gist.github.com/0xbadfca11/00a1efe36b690dc1927fd844355a125e/raw/e1c50b41c59f594ab557ebb1ae73736e05366f08/strace.txt

0xbadfca11 avatar May 12 '17 07:05 0xbadfca11

Don't worry, we already have for this committed and on it's way up :)

zadjii-msft avatar May 12 '17 16:05 zadjii-msft

Yep, that's just caught me out. No worries... any idea how long before the next flight? I could do with a day away from coding :-)

Warblefly avatar May 12 '17 19:05 Warblefly

@Warblefly unfortunately there's basically no way for me to predict how long it'll take the code to get out, sorry.

zadjii-msft avatar May 12 '17 20:05 zadjii-msft

Fair enough. I understand the release schedule is decided elsewhere. Just so you and the team know, I use this subsystem every day for compiling lots of code, and its output is a vital part of my work at a major British university. The compilation still works and I can use another editor beside vim for now. It'll be nice when it's back.

Warblefly avatar May 12 '17 20:05 Warblefly

@Warblefly - First, let me acknowledge that breaking vi is something that we are definitely not proud of. We understand the pain. The issue is fixed internally in our dev branch and we would like to fast-track it. But, we can use your and others help with that. If more people want the fix faster, its easier for us to justify the fast-track. So, if this is important to you and anyone else, please chime in here.

We are always happy to hear when someone tells us that WSL is useful within the education industry. And, we are glad you can use this as your daily driver.

sunilmut avatar May 12 '17 20:05 sunilmut

True. I try to take things lightly, but vim is my standard editor for a lot of professional work in and out of university. To have it not working is going to affect development seriously. I hope you can let the release people know that. Are there any workarounds, other than disabling all the vim features I use every day?

Warblefly avatar May 13 '17 04:05 Warblefly

I have a workaround because this bug has, unfortunately, become mission-critical this morning.

Use sshd.

  1. Start your Bash shell on Ubuntu under Windows as normal.
  2. Make the privilege separation directory for sshd: sudo mkdir /var/run/sshd
  3. Control its permissions: sudo chmod 0755 /var/run/sshd
  4. If you're willing to use password authentication instead of public/private key, edit /etc/ssh/sshd_config to allow this (use the pico editor to change PasswordAuthentication from no to yes)
  5. Start sshd: sudo start-stop-daemon --start --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- -p 22

Now use something like PuTTY to log into localhost (127.0.0.1) and Vim, in all its colours, works. For the complete experience, change your PuTTY font to 'Consolas'.

You will need to login with your Ubuntu on Windows username and password (i.e. the password with which you set-up Ubuntu on Windows when you first installed it). You did make a note of that password, didn't you?

Bizarrely, the console as displayed by PuTTY.exe feels more responsive than the native console window.

Warblefly avatar May 13 '17 08:05 Warblefly

If you don't need fancy terminal features, setting TERM to something like vt100 works. E.g.:

TERM=vt100 vi ~/.bashrc

aledell avatar May 13 '17 15:05 aledell

If more people want the fix faster, its easier for us to justify the fast-track. So, if this is important to you and anyone else, please chime in here.

Consider this me chiming in, although I'm very grateful to @aledell for the workaround or else I'd be using ed or (gasp!) emacs.

daiconrad avatar May 14 '17 20:05 daiconrad

If more people want the fix faster, its easier for us to justify the fast-track. So, if this is important to you and anyone else, please chime in here.

Breaking the default editor should be enough to fast track, no? Anybody using git is likely experiencing this issue. (Maybe the devs on the MSFT team understand the importance but management has other metrics about the "importance" of a fix?)

Anyway, this is my +1 to please fast track this fix.

Also, another work around is to use nano (if emacs is out of the question). 😄

djensen47 avatar May 14 '17 22:05 djensen47

This is very disappointing and is causing me significant inconvenience. I am always trying to evangelise WSL and this bug doesn't help the cause. Getting the fix out quickly is paramount.

nickperry avatar May 14 '17 23:05 nickperry

Could this be related to console changes (and not specifically bash) in latest insider build (16193) ?

Since latest Windows insider build, vim doesn't work anymore. Under bash it hangs like described here, and when ran under normal CMD prompt, display gets empty and it seems to hang too (but I cannot see because display is empty).

This did not happen with previous builds.

warpdesign avatar May 15 '17 11:05 warpdesign

@warpdesign Yes this is a console change that broke this. We had a pretty high code delta that this bug was introduced in. These kinds of issues are expected with Insider's builds.

I'm not positive that this will work, but based on what the fix for this bug was, it might be possible to get around this bug:

I believe that if you immediately start hitting a key on the keyboard after launching vi (eg, spamming 'enter'), then you'll avoid the bug case, and vi will work normally. It might not work on faster (normal) PC's, but it does work on my VMs. The key is to have some input in the input queue as vi is launching.

zadjii-msft avatar May 15 '17 16:05 zadjii-msft

@zadjii-msft Thanks for the wordaround. I found out that any app using the console (like VSCode) is also impacted by the bug. For now I found that checking "use legacy mode" in the prompt window fixes the problem in both cmd.exe and any app using the concole like VSCode (but it prevents the use of bash).

I hope this bug will get fixed quickly.

warpdesign avatar May 15 '17 16:05 warpdesign

PhD student in astrophysics chiming in!

Even though half of my work goes over SSH, eg. running simulations on supercomputers, vim is essential to get the other half of the work done: writing papers.

I found the suggestion of @aledell to work well: echo "export TERM=vt100" >> ~/.bashrc

mariusei avatar May 15 '17 21:05 mariusei

Found this after a lot of head-banging (including removing and reinstalling WSL). I'm using an alias to workaround this (alias v='TERM=vt100 vim' - Thanks @aledell!). Would love for this to get bumped up in priority. I'm not looking forward to using emacs for a while. 😆

JoBrad avatar May 15 '17 22:05 JoBrad

Chiming in for the fast-track request. I can live with the TERM workaround or using nano for the time being to touch files. Where this bites me is that with vim as the default editor, I'm hitting this as other programs (today it's kubectl) invoke it for editing & those are ignoring my hacks :)

noelbundick avatar May 16 '17 14:05 noelbundick

Here is a convenient summary of the workarounds. You can do this on the command line or update your ~/.bashrc

  1. Set the TERM to vt100 by @aledell
export TERM=vt100
  1. Create an alias for vim by @JoBrad

Do this if you don't want to universally set the TERM to vt100.

alias v='TERM=vt100 vim'
  1. Set your default editor to something else or set the TERM env var to vt100
export EDITOR=nano
# or...
export EDITOR='TERM=vt100 vim'

djensen47 avatar May 16 '17 20:05 djensen47

@all - Thanks all for chiming in. With your support, the bug has been approved for fast-track.

sunilmut avatar May 17 '17 02:05 sunilmut

@sunilmut Great! What does fast-track exactly mean? Can we expect a fix in the next insider build?

warpdesign avatar May 17 '17 09:05 warpdesign