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

Sha256sum not working on MacOS #11

Closed
MunchDev opened this issue Feb 15, 2021 · 6 comments
Closed

Sha256sum not working on MacOS #11

MunchDev opened this issue Feb 15, 2021 · 6 comments

Comments

@MunchDev
Copy link

MunchDev commented Feb 15, 2021

I'm using Big Sur 11.2.

Somehow, sha256sum is not pre-installed on my machine. So I have to change from:

echo "5afbcf51a82f629cd65ff23185acde90ebe4dec889ef80bbdc12562fbd0b2611 *Makefile.fetched" \
		| sha256sum --check - \
		&& mv Makefile.fetched Makefile.venv

to:

echo "5afbcf51a82f629cd65ff23185acde90ebe4dec889ef80bbdc12562fbd0b2611 *Makefile.fetched" \
		| shasum -a 256 --check - \
		&& mv Makefile.fetched Makefile.venv

Wonder if it should be updated...

@sio
Copy link
Owner

sio commented Feb 15, 2021

Yeah... macOS does not ship GNU coreutils by default, you need to install them via brew or in some other way. That makes me wonder, which make implementation is shipped by default (if any)? Could you paste the output of make --version?

I am hesitant to change installation instructions as you suggested, because calling Perl to calculate a hash sum instead of using coreutils feels deeply wrong to me. I think I'll add a note about coreutils and mention your workaround too.

@MunchDev
Copy link
Author

MunchDev commented Feb 15, 2021

Output for make --version:

GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

By the way, may I ask why not using coreutils is bad?

@sio
Copy link
Owner

sio commented Feb 15, 2021

Oh, it's not bad and it's not about coreutils per se. It just feels wrong to me to call into interpreted language for a number-crunching task when there exists a compiled binary tool for the same purpose.

@MunchDev
Copy link
Author

Personally, I don't think the performance loss is really significant, since the file Makefile.venv isn't really big. Yet, if shasum is shipped with all Linux distributions plus MacOS, so why not use it?

Apologise if I ask a stupid question!

@sio
Copy link
Owner

sio commented Feb 15, 2021

Your question is not stupid :) I'm being somewhat irrational here, you're right about performance being similar for small files. I'm being too much of a GNU fanboy :)

I'll look into how ubiquitous Perl currently is. I'll check if common Docker containers ship with Perl included, since it's the only scenario I could think of that's questionable. Then I will take a 1-2 day pause to let this sink in, but yeah, the rational thing would be to agree with you.

@sio
Copy link
Owner

sio commented Feb 15, 2021

My intuition proved correct. shasum is not included into any of base Docker images (Alpine, Debian, Ubuntu, Centos). Even though shasum is part of Perl package, deb-based distros provide a smaller perl-base (without shasum) which is enough for OS tools to function.

On the other hand, GNU coreutils are present in each of those images.

I'll add a note about macOS to README now, but the instructions should stay unchanged.

@sio sio closed this as completed in abfec93 Feb 15, 2021
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

No branches or pull requests

2 participants