-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix Base.libllvm_path and jl_get_libllvm don't support non-ASCII characters in path on Windows (#45126) #45127
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
Conversation
src/codegen.cpp
Outdated
| DWORD n16 = GetModuleFileNameW(mod, path16, MAX_PATH); | ||
| if (n16 <= 0) | ||
| return jl_nothing; | ||
| char path8[MAX_PATH * 2]; |
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.
Why *2, not *3?
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.
I can bump it up to 3 to be safe
src/codegen.cpp
Outdated
| if (n16 <= 0) | ||
| return jl_nothing; | ||
| char path8[MAX_PATH * 2]; | ||
| if (!WideCharToMultiByte(CP_UTF8, 0, path16, n16, path8, MAX_PATH * 2, NULL, NULL)) |
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.
Might need +1 to add a trailing null byte here?
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.
Yeah, you're right, I need to fix the null, I'll do that.
|
Is this somehow related to #33486? |
I'm not sure, but I doubt it. This is a very local issue just inside jl_get_libllvm. But there do seem to be a few more non-ASCII username bugs floating around, so I could be wrong. |
|
I still have similar problems |
|
Sorry we forgot to merge this! |
|
@KristofferC that is a rather awkward commit message, which seems to mention several changes that you squashed out of the final version |
Fixes issue #45126, where Base.libllvm_path doesn't support non-ASCII characters. jl_get_libllvm_impl has been changed from using GetModuleFileNameA to using GetModuleFileNameW, along with WideCharToMultiByte to turn it into UTF-8.