-
Notifications
You must be signed in to change notification settings - Fork 59
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
locale not passed WSL's git; leads to unpredictable errors when Win apps need specific Git locale #30
Comments
That's an interesting problem. I agree with you on both 1. and 2. An alternative might be to require users to setup We could add some documentation stating that passing environment variables requires them to be setup in |
You wrote "I assume it is not a problem if Unfortunately, sometimes it is a problem. While spanning across WSLgit and GitLens, I found a bug in WSL microsoft/WSL#3018. Somewhere in the WSL codebase, they get the lang-locale from Win32 and set it in Ubuntu. However, Microsoft didn't consider the interaction of that with the I might have a clearer suggestion of our three ideas...but I don't have a feeling for which one helps the users of WSLgit more and/or doesn't cause more problems. For example, with your idea - to doc the need for WSLENV and other vars...
Number 3 above I think is the hardest for a user. These are vars which are never seen in the Windows control panel or any command prompt. They come and go in a millisecond - yet can significantly change behavior. And are not documented by the app/tool. I looked in the Win32 APIs and I didn't see an easy way, given a env variable, from where did it come (process, user, or system). It is possible to manually query the registry for the user and system env variables - and from that resolve the var's source. I think the code can be written, but suspect it will be buggy as we work through the various edge cases. As reference, a list of vars Git uses https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables. It doesn't list LANG, LC_xxx, or GCM_xxx so there are likely others not on this page. |
Are there actually that many enviornment variables that are relevant?
The |
When a process in Windows runs WSLgit and passes a locale variable (e.g. LC_ALL, LANG, etc.) on that spawn, that variable is not passed to WSL. Therefore, the specific locale requested for Git is ignored and can lead to errors as in in gitkraken/vscode-gitlens#276
This is due to environment variables set in Win32 not being seen in WSL. Good news. This does become possible in Windows 10 build 17063 by configuring the
WSLENV
variable as in https://blogs.msdn.microsoft.com/commandline/2017/12/22/share-environment-vars-between-wsl-and-windows/Here are two ideas to resolve this. Any others?
LANG
orLC_xxx
environment variables. While this will resolve locale, it feels somewhat "chasing a neverending problem" because there are more environment variables on which Git responds. For example, GitLens sets three here gitkraken/vscode-gitlens@6889e2a and all are being dropped by WSLgitThe text was updated successfully, but these errors were encountered: