for all length adjustable algorithms (blake2b, sha2, sha3).
[bug introduced in coreutils-9.2]
+ 'cksum --check -a sha2' now supports tagged format.
+ '-a sha2' is not required with tagged format, but should be accepted.
+ [bug introduced in coreutils-9.8]
+
'rm -d DIR' no longer fails on Ceph snapshot directories.
Although these directories are nonempty, 'rmdir DIR' succeeds on them.
[bug introduced in coreutils-8.16]
/* Check for BSD-style checksum line. */
#if HASH_ALGO_CKSUM
- if (! algorithm_specified)
+ if (! algorithm_specified || cksum_algorithm == sha2)
{
ptrdiff_t algo_tag = algorithm_from_tag (s + i);
if (algo_tag >= 0)
{
if (algo_tag <= crc32b)
return false; /* We don't support checking these older formats. */
+ if (cksum_algorithm == sha2 && algo_tag != sha2
+ && algo_tag != sha224 && algo_tag != sha256
+ && algo_tag != sha384 && algo_tag != sha512)
+ return false; /* Wrong tag for -a sha2. */
cksum_algorithm = algo_tag;
}
- else
+ else if (! algorithm_specified)
return false; /* We only support tagged format without -a. */
}
#endif
done
cksum --strict --check CHECKSUMS || fail=1
-# We don't output but do support SHA2-### tagged format
-cksum -a sha2 -l 384 input |
- sed 's/^SHA/SHA2-/' > sha2-tag.sum || framework_failure_
-cksum --check sha2-tag.sum || fail=1
+# We don't output but do support SHA2-### tagged format.
+# Also ensure we check both formats with and without -a specified.
+cksum -a sha2 -l 384 input > sha384-tag.sum || framework_failure_
+sed 's/^SHA/SHA2-/' sha384-tag.sum > sha2-tag.sum || framework_failure_
+for file in sha384-tag.sum sha2-tag.sum; do
+ for spec in '' '-a sha2'; do
+ cksum --check $spec $file || fail=1
+ done
+done
# Ensure leading whitespace and \ ignored
sed 's/^/ \\/' CHECKSUMS | cksum --strict -c || fail=1