-
Notifications
You must be signed in to change notification settings - Fork 89
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
use default shasum for os x if present #452
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.
I think this is hacks on hacks that is going to be impossible to reliably test and maintain.
let FOUND=0 | ||
|
||
# Try from each mirror until we successfully download a .zip file. | ||
for MIRROR in ${MIRRORS[@]}; do | ||
URL=$MIRROR/$ZIP_FILE | ||
echo "Fetching libc++ from ${MIRROR}..." | ||
echo " Fetching ${URL}..." | ||
wget -O $ZIP_FILE "$URL" && (echo "$GCC_SHA $ZIP_FILE" | sha256sum -c) | ||
# Note: There must be two space characters for `shasum` (sha256sum doesn't care) |
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.
Two space characters where? what is this referring 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.
Between the correct sha and the file name:
❯ echo "1e6f33cd5f44acefebc1ef677db4be33829a5228 README.md" | shasum -a 256 -c
README.md: OK
❯ echo "1e6f33cd5f44acefebc1ef677db4be33829a5228 README.md" | shasum -a 256 -c
shasum: standard input: no properly formatted SHA checksum lines found
@@ -19,14 +19,21 @@ MIRRORS=(\ | |||
"https://alpha.mirror.svc.schuermann.io/files/tock"\ | |||
) | |||
|
|||
if test -x /usr/bin/shasum; then |
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 at least needs a comment. Why this particular path? Do we always prefer shasum
if it is present? Or only if sha256sum
isn't present?
Is this the shasum
that comes with Perl? If so, Perl is a pre-requisite for most Linux distributions in practice, does it make sense to just use shasum
?
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 is what happened in the kernel: tock/tock#1669. Should we have done something differently? I think we just want this to work on as many systems as possible.
@@ -17,14 +17,21 @@ MIRRORS=(\ | |||
"https://alpha.mirror.svc.schuermann.io/files/tock"\ | |||
) | |||
|
|||
if test -x /usr/bin/shasum; then |
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.
That this is duplicated is a bit of a red flag.
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.
Solution looks good to me, and this does solve a real problem.
It's disappointing that this is still an issue, and (apart from all the other reasons why this is bad) we probably don't want to require a host C/Rust toolchain to build our own sha256sum tool in this repo.
For better or worse, it's just propagating over the existing approach (hack? :) ) from the kernel repo, which has been unchanged for years now. Think this hits least-bad pragmatic approach for the current ecosystem of developer machines writ large. |
Fixes #450.