-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jobstart() does not set $NVIM environment variable if /run/user/1000 is not accessible #27962
Comments
Quick Update: I can reproduce this at least down to version 0.9.0. I ran into build issues with 0.8.3 and downwards. I won't be able to fix these build issues during the week due to time constraints. Cheers! |
I downloaded and tried some of the older precompiled binaries. It is always the same behavior. Could there be an issue with forkpty() on wsl? 🤔 Edit: |
I tried this again on a different device running latest Windows 11. Everything works fine there. @zeertzjq I am not sure if we should close this issue now or if it makes sense to further investigate? |
Technically we only support a subset over windows 10. Check https://github.com/neovim/neovim/blob/master/runtime%2Fdoc%2Fsupport.txt#L23-L25 to confirm which version you're using. |
I am on Win 10 build version "19045.4170", which should be supported. It still is surprising to me that the windows version has an effect on a linux binary running in WSL. I am probably missing something here, but I am out of ideas for reasonable next steps. |
Fair, just wanted to make sure. |
I got the same behaviour running on latest Windows 11 and latest nvim, latest WSL2 distro, latest WSL2 kernel. Found this issue through another Neogit issue: NeogitOrg/neogit#1124 However I got it working by turning off my boot systemd in .wslconfig!
That's not really a long time solution though since I need systemd 😓 |
I can confirm that this workaround does work. I agree that this is not a long term solution. My understanding is, that MS is planning to make systemd the default on WSL. |
TLDR: Found a better workaround and more info on what I believe is the actual issue. Workaround 1: Workaround 2 (preferred, I believe it's totally fine to take ownership of that folder, doesn't change after wsl --shutdown either):
What got me thinking in that direction was when comparing the difference in env vars for the child processes created by Neovim.
The permissions for /run/user/1000 do require root access as see when running
Found a issue for WSL here: microsoft/WSL#10498 |
Did Nvim log anything in |
The logs seem to be pretty good, wish I'd looked there in the beginning 😓 :
|
Problem
Description
This issue originated from the discussion in this bug report when using the plugin 'neogit'. However, I believe the root cause to be a bug in neovim itself.
The documentation states that
vim.fn.jobstart(cmd)
creates a subprocess with the appended environment variable $NVIM pointing tov:servername
(the parent nvim instance). As far as I can tell, this works fine on native Linux and macOS. On WSL Distros, the env var appears to be unset:Steps to reproduce
(0. Be on WSL)
Use a tool like htop to figure out the PID of the child process
Observe environment of the given process
I can reproduce this with the latest neovim stable and nightly builds. Personally, I use Ubuntu WSL, but my understanding from the comments in the original (neogit) issue is that this happens on several, if not all, WSL distros.
Please let me know if I can be of further assistance in debugging this issue!
Steps to reproduce
(0. Be on WSL)
Use a tool like htop to figure out the PID of the child process
Observe environment of the given process
I can reproduce this with the latest neovim stable and nightly builds. Personally, I use Ubuntu WSL, but my understanding from the comments in the original (neogit) issue is that this happens on several, if not all, WSL distros.
Please let me know if I can be of further assistance in debugging this issue!
Expected behavior
I expect $NVIM to be set to
v:servername
Neovim version (nvim -v)
NVIM v0.10.0-dev-2663+gc1c6c1ee1
Vim (not Nvim) behaves the same?
Operating system/version
Ubuntu WSL
Terminal name/version
tmux
$TERM environment variable
screen-256color
Installation
system package manager
The text was updated successfully, but these errors were encountered: