Fix null character corruption in environment variables causing Visual C++ configuration failure #4661
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses item #4139
This changes visible behavior
The following changes are proposed:
\u0000) from environment variable values inEnvironmentPrivate.set()The purpose of this change
When PATH contains CJK characters and Windows UTF-8 beta mode is enabled, encoding corruption can introduce null bytes into environment variable values. Node.js
child_process.spawnthrows on null characters, causing Visual C++ configuration to fail with"cl undefined" returned code -1.Example corrupted path from issue:
Fix strips null bytes when setting environment variables:
Other Notes/Information
valuecan benullwhenpreserveNullistrueWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
0psvsblobprodwus2145.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/npm install(dns block)2wrvsblobprodwus2180.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)40vvsblobprodwus2135.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)/usr/local/bin/node node /usr/local/bin/npm install(dns block)5bdvsblobprodwus2128.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/npm install(dns block)7t8vsblobprodwus2168.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/npm install(dns block)b15vsblobprodwus2164.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)b53vsblobprodwus2154.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)d94vsblobprodwus2119.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)ezcvsblobprodwus2170.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/npm install(dns block)k4pvsblobprodwus2140.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)/usr/local/bin/node node /usr/local/bin/npm install(dns block)n6wvsblobprodwus2123.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)p2tvsblobprodwus2189.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)v41vsblobprodwus2175.vsblob.vsassets.io/usr/local/bin/node node /usr/local/bin/yarn install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug] When Environment Path contains CJK Characters, Visual C++ may not be configured</issue_title>
<issue_description>### Brief Issue Summary
It's a strange bug, and I don't know why.
Background: I am a Chinese user(code page 936), but enabled
Beta: use utf-8 for worldwide language supportDue to some reasons, I have such a key
C:\\微信web开发者工具\\dllin my path and it will be read as43 3A 5C 5C 00 00 77 65 62 5C 75 30 30 30 30 00 5C 75 30 30 30 35 00 77 5C 5C 64 6C 6Con my computer. You see there contains \u0000 so node child process will throw an error.CMake Tools Diagnostics
{ "os": "win32", "vscodeVersion": "1.107.0", "cmtVersion": "1.13.0", "configurations": [ { "folder": "c:\\Users\\Alphagocc\\Documents\\Programming\\Project\\LemonLime\\Project_LemonLime", "cmakeVersion": "4.2.0", "configured": true, "generator": "Ninja", "usesPresets": false, "compilers": {} } ], "cpptoolsIntegration": { "isReady": false, "hasCodeModel": false, "activeBuildType": "", "buildTypesSeen": [], "requests": [], "responses": [], "partialMatches": [], "targetCount": 0, "executablesCount": 0, "librariesCount": 0, "targets": [] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": true } ] }Debug Log