-
Notifications
You must be signed in to change notification settings - Fork 888
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
Check for unexpected cargo/rustc before install #705
Check for unexpected cargo/rustc before install #705
Conversation
Hm, I didn't account for I worked around this issue in 3897c2a by filtering any path entry that contains ".multirust", but it feels hacky. |
Looking at Travis' build logs more closely, it seems a couple more entries in I'm not sure what to make of the test failures in Windows. I guess I'll boot up a virtual machine and debug it there. EDIT: I was trying to use |
Thanks at @meqif, and thanks for writing tests! From the various build failure here it's clear this needs to be considered carefully. Some observations: The windows failure might be because the you are filtering out paths ending with ".cargo/bin" and windows uses backslashes canonically; though I'd be a bit surprised if the For the error message I think we should print out the path to the binary that we found so that users can decide whether what rustup is thinking makes sense. Maybe it can say "of Rust at:", and the next line can print the path. I suspect this will look a bit ugly but it's a rare case so maybe it doesn't have to be beautiful (and rustup already has a lot of ui issues...). By setting The linux failures are interesting. The builders use a Rust not installed by rustup, so the test cases are finding those toolchains that are being used to test rustup and failing! Messy situation. The best idea I have to fix this is to use an environment variable just for the test suite to tell OK, I know that was a lot to digest, and it's kinda messy, but that's sorta the territory of this tool. Let me know if it makes sense. |
Oh, also I think it's fine to just filter out all paths containing ".multirust". |
Thank you so much for the thoughtful feedback, @brson. 👍
That makes sense, you're probably right. I suppose it would have been fine if I used something like
Good idea. I was doing that during the development of the PR, but removed it because it did look a little ugly. Oh well, now it's back.
Ah, thank you. I wasn't aware there was such a significant difference. I ended up doing something similar to what you suggested. I checked where |
There seems to be a (spurious?) issue with fetching one of |
I tracked down that build issue and opened another pull request that fixes it: #711. |
Patch looks good to me! I think now that your rustls fixes are merged you'll need to rebase onto master to get travis to test this pr correctly. |
Great! Let's hope nothing else goes wrong this time around. 💃 |
The tests pass in every Travis target, but not in Windows:
I assume I'm missing some special setup, but I'm not sure what it is. Any advice? |
Since only the interactive tests fail, but not the non-interactive one, I've been looking at the tests in So, I added a helper that makes the PATH modification and as |
Oh bother, they still fail on Windows — the installation doesn't abort like it should. Well, at least I learned something. |
I finally noticed that the file checks didn't account for |
☔ The latest upstream changes (presumably #850) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #842) made this pull request unmergeable. Please resolve the merge conflicts. |
Thanks for the rebase @meqif. The x86_64-pc-windows-gnu error looks legit. I haven't been able to reproduce it though because I don't have a working mingw environment :-/ |
☔ The latest upstream changes (presumably #1012) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #1005) made this pull request unmergeable. Please resolve the merge conflicts. |
Hi @meqif, are you still looking into this? Would you like any help debugging the test failures? |
Hi @Diggsey! I've been trying to reproduce the test failure on |
If RUSTUP_INIT_SKIP_PATH_CHECK is set to "yes", ignore the PATH checks for rustc and cargo. The variable is set to "yes" by default in clitools::env, and overriden in the relevant tests. Fixes #681
Looks good to me, but it's slightly worrying that this code will effectively be untested, since we have to disable the path check on CI, and if it goes wrong it will prevent rustup from being installed. @brson thoughts? |
It was a long fight, but it was worth it. 💪 Thanks for merging! |
Hi!
This PR fixes #681, stopping the installation if rustc or cargo are found in any directory listed in
$PATH
if rustup wasn't invoked with-y
.Besides ignoring rustc and cargo if they exist in
$HOME/.cargo/bin
, as described in #681, this PR also ignores them if they're found in$HOME/.multirust
, a situation that popped up during testing. What do you think?I was also unsure about the error message, so I ended up copying a large portion from a similar situation in
do_pre_install_sanity_checks
(if rustc_exists
, to be specific). Better alternatives would be very appreciated.Finally, thank you for your work on rustup, it's a very nice tool. :)