mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 03:12:48 +02:00
cksum: fix --check with non tagged format checksums
* src/digest.c: Always set the digest_length, so that we check the correct number of hex digits when parsing non tagged format checksums. * tests/misc/cksum-a.sh: Add a test case. Also fix up this test which was ineffective due to fail=1 being set in a subshell and ignored.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ cksum
|
||||
|
||||
printf "
|
||||
cat > input_options <<\EOF || framework_failure_
|
||||
bsd sum -r
|
||||
sysv sum -s
|
||||
crc cksum
|
||||
@@ -30,10 +30,21 @@ sha256 sha256sum -t
|
||||
sha384 sha384sum -t
|
||||
sha512 sha512sum -t
|
||||
blake2b b2sum -t
|
||||
" | while read algo prog; do
|
||||
$prog < /dev/null >> out || continue
|
||||
cksum --untagged --algorithm=$algo < /dev/null >> out-a || fail=1
|
||||
done
|
||||
EOF
|
||||
|
||||
while read algo prog; do
|
||||
$prog /dev/null >> out || continue
|
||||
cksum --untagged --algorithm=$algo /dev/null > out-c || fail=1
|
||||
|
||||
case "$algo" in
|
||||
bsd) ;;
|
||||
sysv) ;;
|
||||
crc) ;;
|
||||
*) cksum --check --algorithm=$algo out-c || fail=1 ;;
|
||||
esac
|
||||
|
||||
cat out-c >> out-a || framework_failure_
|
||||
done < input_options
|
||||
compare out out-a || fail=1
|
||||
|
||||
returns_ 1 cksum -a bsd --tag </dev/null
|
||||
|
||||
Reference in New Issue
Block a user