-
Notifications
You must be signed in to change notification settings - Fork 371
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
Windows: Fixed environment variables not read as unicode. #2417
Conversation
7588673
to
15206f3
Compare
For info I'm trying to rewrite the solution with the safe functions and to handle the setenv because otherwse tests cannot pass. |
bfeb86f
to
d042ea5
Compare
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.
Thanks 🎉
Can we take this opportunity to add some libmamba tests? Since we have env::get
and env::set
we can at least test them together.
Testing env::get
alone would require setting an env var from outside the test exe. Not perfect, but maybe necessary?
LOG_ERROR << fmt::format( | ||
"Failed to acquire environment variable '{}' : errcode = {}", | ||
key, | ||
error_code | ||
); |
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.
Nit: One can also do (with the right header)
LOG_ERROR << fmt::format( | |
"Failed to acquire environment variable '{}' : errcode = {}", | |
key, | |
error_code | |
); | |
fmt::format_to(LOG_ERROR, | |
"Failed to acquire environment variable '{}' : errcode = {}", | |
key, | |
error_code | |
); |
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.
BTW I know this is possible but I dont know if that changes something performance-wise for fmt? Do you know?
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.
Actually I tried that syntax and it doenst seem to compile, probably lacks some compatibility layer to add. I'll keep it as is for now.
@AntoinePrv I can add more tests although note that I had to change |
I will also add a basic test for the unicode functions. |
@AntoinePrv I added basic tests using |
6240439
to
579a65b
Compare
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.
Thanks!
…TF-16, for specific usage with Windows APIs
…y existing. This might also catch issues with home paths containing unicode.
…uming it will not change for a long time in Windows)
579a65b
to
3de4685
Compare
…e one in Windows.h
The code acquiring environment variables on Windows was doing so using the non-unicode API which lead to some environment variables containing unicode path (or other unicode values) leading to random crashes.
This version uses a simpler API call which is unicode-enabled and should fix #2153