-
Notifications
You must be signed in to change notification settings - Fork 893
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
Add env variable to override the fallback settings file path #2545
Conversation
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.
Thank you for trying to fix this issue.
There's a minor snafu in your code which will be easy for you to fix, however the important reason for wanting this feature is so that our test code doesn't use /etc/rustup/settings.toml
when testing rustup
. In here: https://github.com/rust-lang/rustup/blob/master/tests/mock/clitools.rs#L410 you will see how we set up the environment to run test code, at minimum setting the environment variable to something we know won't exist might be a good starting point. However this could also be an opportunity to introduce the ability to test the fallback code.
While it pains me to say, you didn't format the code or test it before submitting that. There's a little more work you need to do, likely involving a bit of shifting around of the Also, have you given any thought to a way we might test this? |
Sorry, I didn't mean to actually push this! It's still a work in progress, I'll update the PR title accordingly. Thanks for your advices! |
I think this PR is ready for a second review! The unit test setup was updated to set the Also, a unit test was added for Unix plarforms where the fallback settings mechanism is tested. Let me know if further changes are required e.g. squashing the commits. |
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 think this looks good. @rbtcollins since this touches the process/env stuff I'd like you to just run your eye over it; but I think it's right.
Content-wise it looks good. If @rbtcollins is okay with it, then I'd like it rebased into a neater commit if you don't mind. |
Commits squashed! Let me know if anything else needs fixing |
I'm going to assume Robert is too busy right now, and so since I think it's good I'll merge it, thank you. |
This PR introduces the support for overriding the path of the fallback settings file (
/etc/rustup/settings.toml
) by specifying theRUSTUP_OVERRIDE_UNIX_FALLBACK_SETTINGS
environment variable.The fix can be verified by running the following commands
Fixes #2456
Issue #2456 also mentions that the env variable should be "set up in the mock test support glue", but I'm not sure what it means..