-
Notifications
You must be signed in to change notification settings - Fork 877
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
Multiple fixes for windows registry handling #264
Conversation
The problem in #263 was failure to null-terminate, which really messes things up! |
This is still going to bust any PATH which contains invalid unicode, which is unfortunate. When I get time I'd like to implement the solution using OsString which I mentioned on the previous PR. |
☔ The latest upstream changes (presumably #259) made this pull request unmergeable. Please resolve the merge conflicts. |
Yeah, blanking the regkey if it's non-unicode is bad. Should probably be fixed in this pr. |
let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE); | ||
|
||
if environment.is_err() { return } | ||
let environment = environment.expect(""); |
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.
Could this be:
let environment = match environment {
Ok(e) => e,
Err(..) => return,
};
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.
Yes, but I don't like that it takes four lines to do an early return.
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'll change it anyway ... grumble
r=me with the unicode bits fixed up (that you mentioned) |
f69b97e
to
c478a59
Compare
Updated for feedback. Now when rustup encounters a non-unicode PATH on windows during install or uninstall it will print a warning and not attempt to modify it. |
@bors r=alexcrichton |
📌 Commit c478a59 has been approved by |
Multiple fixes for windows registry handling This includes @petrochenkov's fix for non-existant HKCU\Environment\PATH, as well as fixes for #261, wherein we were setting this key to be a `REG_SZ` type instead of `REG_EXPAND_SZ`. My second commit adds tests for more scenarios brought up by @petrochenkov's handling of non-existing registry keys.
☔ The latest upstream changes (presumably #272) made this pull request unmergeable. Please resolve the merge conflicts. |
(I'd just merge this, I doubt bors will ever get around to finishing) |
💥 Test timed out |
Fixes rust-lang#261 Also throw in some compatibility code to automatically fix this on machines we've broken.
This includes @petrochenkov's fix for non-existant HKCU\Environment\PATH, as well as fixes for #261, wherein we were setting this key to be a
REG_SZ
type instead ofREG_EXPAND_SZ
.My second commit adds tests for more scenarios brought up by @petrochenkov's handling of non-existing registry keys.