Commit 041c586c by Yamashita, Yuu

Ignore everything after whitespace in the output from sha256sum (fixes #1126)

The issue has originarily reported as pyenv/pyenv#902.

Unlike sha256sum of GNU coreutils, BusyBox one doesn't print '*'
and prints extra whitespaces, when computing digest from stdin.

sha256sum (GNU coreutils 8.26)

```
% cat /sbin/init | sha256sum -b
ef753e9504ada221155b86e7e6b7b4ff2499d64e27bcd959f0542bcac589feb1 *-
```

sha256sum (BusyBox v1.26.2)

```
/ # cat /sbin/init | sha256sum -b
4cd6d1a4028772fabc9166bb52b5826aec4e91874c107fce33dc515c04cb754f  -
```

I also confirmed that md5sum behaves just similarly.
parent 86909bfd
...@@ -225,7 +225,7 @@ compute_sha2() { ...@@ -225,7 +225,7 @@ compute_sha2() {
echo "${output##* }" echo "${output##* }"
elif type sha256sum &>/dev/null; then elif type sha256sum &>/dev/null; then
output="$(sha256sum --quiet)" || return 1 output="$(sha256sum --quiet)" || return 1
echo "${output% *}" echo "${output%% *}"
else else
return 1 return 1
fi fi
...@@ -240,7 +240,7 @@ compute_md5() { ...@@ -240,7 +240,7 @@ compute_md5() {
echo "${output##* }" echo "${output##* }"
elif type md5sum &>/dev/null; then elif type md5sum &>/dev/null; then
output="$(md5sum -b)" || return 1 output="$(md5sum -b)" || return 1
echo "${output% *}" echo "${output%% *}"
else else
return 1 return 1
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment