Pyinfra: files.download Operation Failes Sha256Sum Check on MacOS

Created on 1 Sep 2020  路  3Comments  路  Source: Fizzadar/pyinfra

Describe the bug
files.download operation fails to check sha256 hash on macOS host.

To Reproduce
Run a files.download operation on a macOS host and specify a sha256sum argument:

files.download(
    name = 'Download'
    ,src       = 'https://...'
    ,dest      = '...'
    ,sha256sum = 'sha256sum of the file'
)

Expected behavior
The sum verification to work.

The operation seems to try sha256sum and sha256, but not sha2sum which is what's on macOS. This seems to be similar to the shasum one reported on #365:

sh -c '((sha256sum /Users/myuser/myfile.tar.gz 2> /dev/null || sha256 /Users/myuser/myfile.tar.gz) | grep...) || (echo "SHA256 did not match!" && exit 1)'

Bug

All 3 comments

Which version of MacOS is this out of interest? I've not got sha2sum locally but do have sha256 sum (using Catalina)!

UPDATE: looks like shasum -a 256 is builtin on MacOS everywhere so should work.

I am using Catalina also.

UPDATE: looks like shasum -a 256 is builtin on MacOS everywhere so should work.

My mistake! I did mean shasum, I am not sure why I wrote shas2sum, sorry about that.

I just tried on 3 different Catalina installs, one which is fresh, and none had sha256, or sha256sum, just shasum.

Was this page helpful?
0 / 5 - 0 ratings