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
win: perform case insensitive PATH= comparison #1837
Conversation
src/win/process.c
Outdated
@@ -831,7 +831,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { | |||
*/ | |||
static WCHAR* find_path(WCHAR *env) { | |||
for (; env != NULL && *env != 0; env += wcslen(env) + 1) { | |||
if (wcsncmp(env, L"PATH=", 5) == 0) | |||
if (_wcsicmp(env, L"PATH=", 5) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_wcsicmp()
is affected by calls to setlocale()
. I'd just write it out in full to avoid any confusion:
if ((env[0] == L'P' || env[0] == L'p') &&
(env[1] == L'A' || env[1] == L'a') &&
// etc
Thanks for the quick turnaround on getting this change underway, @cjihrig. 👍 |
Good enough CI with Ben's suggestion: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/831/ |
Should we note in the docs what happens on Windows when more than one variant of |
@richardlau would you be willing to open a docs PR? You seem to have a pretty good handle on what you'd like them to say. |
Refs: nodejs/node#20605 PR-URL: libuv#1837 Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Yes, but I'd like to convince myself first that the behaviour is actually desired. Copying from nodejs/node#20605 (comment):
|
Fixes: #20605 Refs: libuv/libuv#1837 PR-URL: #32091 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixes: #20605 Refs: libuv/libuv#1837 PR-URL: #32091 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixes: #20605 Refs: libuv/libuv#1837 PR-URL: #32091 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixes: #20605 Refs: libuv/libuv#1837 PR-URL: #32091 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
If I'm reading nodejs/node#20605 properly, then it seems that this comparison should be case insensitive. Untested locally, but that's what the CI is for.