Skip to content
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

Improve OS detection of rustup-init.sh #2042

Merged
merged 2 commits into from
Jan 10, 2020
Merged

Conversation

Rudi3
Copy link
Contributor

@Rudi3 Rudi3 commented Oct 7, 2019

An attempt to fix #1946.

Checks if $ARCH contains "darwin" before checking the the existence of sw_vers and the software version of an alleged darwin os.

@kinnison
Copy link
Contributor

kinnison commented Oct 7, 2019

Given I discovered that #1946 was a bad issue (my fault) I'm not sure we need this.

@Rudi3
Copy link
Contributor Author

Rudi3 commented Oct 7, 2019

Maybe not, but you may not wan't to solely rely on the existence of sw_vers to detect darwin as it can "easily" be fooled. $ARCH should be more reliable. On the other hand, it should not be that likely to have a fake sw_vers. ^^

@kinnison
Copy link
Contributor

kinnison commented Oct 8, 2019

Fair, I'll give this a bit more of a ponder. Belt and braces can't hurt I suppose.

@kinnison
Copy link
Contributor

I'm not sure I like the amount of code churn needed to have the global $ARCH but I also don't like the idea of having to call get_architecture from multiple places. It'd be non-trivial to thread $_arch through all the calls, leaving the possibility of just checking $(uname -s) in the check_help_for function. I remain unsure which approach is best over-all because we abstracted uname checking into get_architecture for a reason. I'm not going to make a call on this yet, but if you could come up with a way to minimise the change while having the same effect, I'd like to see a reduced patch.

@kinnison
Copy link
Contributor

kinnison commented Dec 3, 2019

I remain uncomfortable with this change. If a reduced scope patch is produced I'll consider it, otherwise I'll close this PR soon. Thank you for caring enough to try and fix this.

@rbtcollins
Copy link
Contributor

its pretty trivial really.

_arch -> downloader -> check_help_for. Its one code path, one variable.

@Rudi3
Copy link
Contributor Author

Rudi3 commented Dec 4, 2019

Yes, I could just pass it through like you suggested. I'll try that soon.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks plausible. I'm not in a position to fully review the change right now, but I shall endeavour to do so soon. My gut feeling says this could be merged now.

@kinnison
Copy link
Contributor

I apologise for the delay, my December was crazy and then I was unwell. 👍

@kinnison
Copy link
Contributor

I've rebased your branch. Assuming this passes CI, I'll merge.

@kinnison kinnison merged commit df0894e into rust-lang:master Jan 10, 2020
AJ-Ianozi pushed a commit to AJ-Ianozi/getada-download that referenced this pull request Oct 12, 2023
Improve OS detection of rustup-init.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect detection on Debian/Buster
3 participants