-
Notifications
You must be signed in to change notification settings - Fork 884
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
Allow installing alongside existing Rust (with warning) #2214
Conversation
Hi @sollyucko Thanks for your wanting to contribute to Rustup. I'm sorry that you're having difficulty with If you want to work on this, let me know, otherwise it'd be better to open a more descriptive issue detailing how this is necessary for I hope you're up for the work, because I think it'd be useful, but I understand if you don't have the space to do it, rustup is quite big to build :D |
What do you think of my latest commit (46cf331)? It currently requires either replying to a confirmation prompt or specifying the -y flag, and produces warnings no matter what. |
Oops, fixed formatting. (c11150c) |
Need to fix test cases... |
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.
As you say, you'd need to deal with test hiccoughs (I imagine there's plenty of installer tests which will need tweaking, and I'll want to see at least some hint of testing the bypassing of the error if possible), and there're some bits to tweak, but this is making progress.
Assuming there aren't any more issues, I think all I have left to do is to add some more test cases. |
@kinnison This now has a working implementation and tests for each method of skipping or ignoring the check. Is this ready to merge, or are there any issues I should fix? Thanks for the suggestions, BTW. |
Hi @sollyucko thanks for your efforts in improving this work. I shall review the over-all diff since you have so many commits on this branch. Assuming I'm happy with the work, we'll need it rebasing into a smaller number of commits which logically express the work you did; rather than the actual process by which you achieved the final result. That way, the history is more useful if we need to work out why a line of code is the way it is. I shall review your work tonight. |
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.
Your testing looks excellent. A few comments are inline, and as previously stated, once things look good we'll need the commit sequence rebasing to clean it up.
I am very excited by this work.
tests/cli-inst-interactive.rs
Outdated
let mut cmd = clitools::cmd(config, "rustup-init", &["-y"]); | ||
clitools::env(config, &mut cmd); | ||
cmd.env("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS", "yes"); | ||
|
||
cmd.stdin(Stdio::piped()); | ||
cmd.stdout(Stdio::piped()); | ||
cmd.stderr(Stdio::piped()); | ||
let _out = cmd.spawn().unwrap().wait_with_output().unwrap(); | ||
let out = SanitizedOutput { | ||
ok: _out.status.success(), | ||
stdout: String::from_utf8(_out.stdout).unwrap(), | ||
stderr: String::from_utf8(_out.stderr).unwrap(), | ||
}; |
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 feel like if this wasn't already possible via clitools more directly, then we need to improve that, rather than having this code in a test case. It makes it harder to see what the test case is up to.
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.
This was copied from run_input
, not clitools
.
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 see. It'd be preferable to make run_input()
more generic (perhaps run_input_with_env()
with run_input()
changed to call through that) just so that we don't end up with code duplication for this stuff.
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.
Good idea.
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.
In your rebase I think you lost this bit of the test change.
Yeah, the commits are definitely a mess... |
Does this
|
I'd probably make the |
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.
This change is starting to look really good. Let's get the rebase done, and then I will go over the UX aesthetics by running it on my laptop to see how it feels. In general this is very promising though.
Rebase done! |
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.
You've managed to lose the use of run_input_with_env()
in your test case during the rebase. That needs fixing.
Also, do you need to keep the renaming of non_fatal()
as a separate commit or can that be folded into the original work?
Oh, oops.
I'll squash it in. |
Both of those should now be fixed. |
0e2333d
to
251bb55
Compare
I shall re-review this tonight, Thanks. |
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.
The code now looks good, I need to see how I feel when I run this locally and experiment, but I'm pretty sure it's mergeable.
Sounds good, thanks! |
Err("cannot install while Rust is installed".into()) | ||
} else { | ||
Ok(()) | ||
ignorable_error("cannot install while Rust is installed".into(), no_prompt)?; |
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.
Errata: this is not ignorable if the location of the existing rust is in the CARGO_BIN directory that rustup's proxies will be written to. We're making this easier to run into, so perhaps we should check for that at this point.
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.
@rbtcollins Should it be possible to skip it in any way (e.g. environment variable) or not?
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.
Currently the code will give a warning later about "tool X is already installed", and not touch those binaries. This would mean that rustup isn't actually installed. I don't think it makes sense to allow that to be bypassed, but would like @kinnison 's input. This might be something to do as a separate PR for instance.
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.
The cases this PR covers are to do with rustc
on the PATH
or about detecting an old-style rustup.sh
install as I understand the change. If it happens that it's in CARGO_BIN
then the user is going to get warnings as you say, and if they ignore those then they get to keep all the pieces. I don't think we can stop all the footguns -- this is simply a way to allow another footgun for someone who really can't install rustup
otherwise due to immutable underlying layers.
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.
The concern I have is that this is escalating it from a read-the-docs situation to a y/n prompt, so perhaps a lot easier to perform targeted foot removal.
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.
Possibly so. I shall check the feel of that in my testing which I'm about to undertake.
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.
Okay so the issue here is that if the rustc/cargo
is in $CARGO_BIN
then the only real pain is that rustup
will replace them with proxies without prompting. The only tools you get the warnings about are rustfmt
and cargo-fmt
because those used to be provided via cargo install
rather than always being proxied via rustup
. I think that the footgun is permissible in this case because it's exceedingly unlikely that the user will have set up this kind of thing without also being aware of what rustup-init
will end up doing
Hi @sollyucko I've now done some user-testing and I'm concerned about some of the wording... When you have
It seems odd to both tell the user they have to restart and pass
Otherwise I think I'm okay with this. So if you can look over and provide a better message, we're close to being able to merge this. |
Does this look good? |
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.
Let's get this merged and see how we feel over time. Thank you.
See #953
FYI, I haven't been able to test this because I run out of disk space, which is why telling users who want to install alongside an existing install to modify the source and recompile doesn't work. (Specificially, I am trying to run nightly Rust on repl.it.)