I got this curious problem with Alpine. I want to check the checksum of a file inside a bash console. It works under CentOS but not under Alpine. Where is the error?
Under CentOS
$ sha1sum /bin/tini
fa23d1e20732501c3bb8eeeca423c89ac80ed452 /bin/tini
$ echo "fa23d1e20732501c3bb8eeeca423c89ac80ed452 /bin/tini" | sha1sum -c -
/bin/tini: OK
Under Alpine
$ sha1sum /bin/tini
fa23d1e20732501c3bb8eeeca423c89ac80ed452 /bin/tini
$ echo "fa23d1e20732501c3bb8eeeca423c89ac80ed452 /bin/tini" | sha1sum -c -
sha1sum: WARNING: 1 of 1 computed checksums did NOT match
Could you try adding 1 space (total 2) between the checksum and the path:
$ echo "fa23d1e20732501c3bb8eeeca423c89ac80ed452 /bin/tini" | sha1sum -c -
I've tried with /bin/busybox
:
# sha1sum /bin/busybox
71bdaf6e52759f7f277c89b694c494f472ca2dfb /bin/busybox
# echo '71bdaf6e52759f7f277c89b694c494f472ca2dfb /bin/busybox' | sha1sum -c -
sha1sum: WARNING: 1 of 1 computed checksums did NOT match
# echo '71bdaf6e52759f7f277c89b694c494f472ca2dfb /bin/busybox' | sha1sum -c -
/bin/busybox: OK
The error is because sha1sum
expects its own output as input when called with -c
and its output uses 2 spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With