331576717 / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

VIM shell extension added LANG environment variable to explorer.exe #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. reboot
2. right click any file
3. after menu popup, LANG environment variable (with value zh_CN) is injected 
to explorer.exe (which will affect any new child process of it)

What is the expected output? What do you see instead?
-

What version of the product are you using? On what operating system?
vim73_46 on Windows XP Professional (Simplified Chinese).

Please provide any additional information below.
I'm not sure why VIM need a LANG environment variable to be put to 
explorer.exe, because even without LANG environment, vim display the correct 
GUI language (for me, it's simplified chinese).

Add a LANG environment variable to explorer.exe will affect all new child 
process, I often use Cygwin 1.7, LANG will affect Cygwin to display 
Chinese/multibytes characters.

If LANG environment is needed by vim.exe/gvim.exe, why not putenv to 
vim.exe/gvim.exe itself instead of explorer.exe?

related code may be here:
http://code.google.com/p/vim/source/browse/src/GvimExt/gvimext.cpp#286

Original issue reported on code.google.com by loveti...@gmail.com on 16 Jun 2011 at 3:01

GoogleCodeExporter commented 9 years ago
This should be fixed by patch 7.3.276.  Please verify.

Original comment by brammool...@gmail.com on 10 Aug 2011 at 2:33

GoogleCodeExporter commented 9 years ago
Looking at the current code, I don't see how this would be fixed.

The patch apparently touches code that is responsible for launching gvim.exe, 
but LANG= is injected into explorer.exe already at this point.
LANG= will leak into ALL OTHER processes started by Explorer, which also hosts 
the Start Menu, therefore the LANG set by the Vim Shell Extension is very 
likely to leak into ALL OTHER processes started by the user.

The environment of the calling process (which can be a random process hosting a 
Common Controls Dialog or a shell view or something else) is never safe to 
modify.

Please consider not setting LANG= at all.

(I could not test patch 276 as I do not have a vim build environment here and 
the prebuilt binary is patch level 46.)

Original comment by christia...@gmail.com on 29 Dec 2012 at 10:43