aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cksum (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-10-07tests: cksum: add a test case for robust file name parsingPádraig Brady1-0/+6
* tests/cksum/cksum-c.sh: Add a test case where the file name contains tagged format delimiter characters.
2025-10-07cksum: fix --check with untagged base64 format with tag matchesPádraig Brady1-0/+8
* src/digest.c (split_3): Fallback to untagged matching in the case where -a is specified and we have matched a TAG in the possibly base64 data. This might happen in 1 in every 64K files. Note we remove the modification of string S (and redundant streq) in the tag matching, as that was not needed since v8.32-223-g217cd278e. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-07cksum: fix length validation with SHA2- tagged formatPádraig Brady1-0/+10
* src/digest.c (sha2_sum_stream): Change from unreachable() to affirm() so that we have defined behavior unless we configure with --disable-assert. (sha3_sum_stream): Likewise. (split_3): Validate SHA2-lengths before passing on. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-07cksum: fix --check with --algorithm=sha2Pádraig Brady1-4/+9
* src/digest.c (split_3): Look up the provided tag with -a sha2 because there is not a 1:1 mapping between them. * tests/cksum/cksum-c.sh: Add a test case. * NEWS: Mention the bug fix.
2025-10-05cksum: allow -a {blake2b,sha2,sha3} --check to work on base64Collin Funk1-0/+50
* NEWS: Mention the bug. * src/digest.c (split_3): Check that the base64 digest matches the length supported by the algorithm. (digest_check): Check that the read digest matches the base64 length of the algorithm's digest. The previous condition would not work for 'cksum -a blake2b -l 8 ...'. * tests/cksum/cksum-base64-untagged.sh: New file. * tests/local.mk (all_tests): Add the new test.
2025-09-21maint: comment spelling fixesPaul Eggert1-1/+1
2025-09-14cksum,wc: support disabling hardware acceleration at runtimePádraig Brady1-6/+17
This is useful to give better test coverage at least, and may be useful for users to tune their environment. * bootstrap.conf: Reference the cpu-supports gnulib module. * src/cksum.c: Use cpu_supports() rather than __builtin_cpu_supports(). * src/wc.c: Likewise. * tests/cksum/cksum.sh: Adjust to testing all implementations. * tests/wc/wc-cpu.sh: A new test to do likewise. * tests/local.mk: Reference the new wc test.
2025-09-04tests: cksum: check more length variantsPádraig Brady1-19/+20
* tests/cksum/cksum-raw.sh: Adjust to non legacy naming, and also check various length variations. * tests/misc/read-errors.sh: Likewise.
2025-09-04cksum: prefer -a sha2 -l ###, to -a sha###Pádraig Brady3-6/+19
To make the interface more concise and consistent, while being backwards compatible. * src/digest.c (main): Continue to support -a "sha###" but also support -a "sha2" and treat it like "sha3", except in... (output_file): ... maintain the legacy tags for better compatability. * doc/coreutils.texi (cksum invocation): Document the -a sha2 option. * tests/cksum/cksum-base64.pl: Adjust as per modified --help. * tests/cksum/cksum-c.sh: Add new supported SHA2-### tagged variant. * NEWS: Mention the new feature.
2025-09-03cksum: add support for SHA-3Collin Funk2-1/+86
* src/digest.c: Include sha3.h. (BLAKE2B_MAX_LEN): Rename to DIGEST_MAX_LEN since it is also used for SHA-3. (sha3_sum_stream): New function. (enum Algorithm, algorithm_args, algorithm_args, algorithm_types) algorithm_tags, algorithm_bits, cksumfns, cksum_output_fns): Add entries for SHA-3. (usage): Mention that SHA-3 is supported. Mention requirements for --length with SHA-3. (split_3): Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Determine the length of the digest for SHA-3. Make sure it is 224, 256, 384, or 512. (digest_file): Set the digest length in bytes. Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Always append the digest length to SHA3 in the output. (main): Allow the use of --length with 'cksum -a sha3'. Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Make sure it is 224, 256, 384, or 512. * tests/cksum/cksum-base64.pl (@pairs): Add expected sha3 output. (fmt): Modify the output to use SHA3-512 since that is the default. (@Tests): Modify arguments for sha3 to use --length=512. * tests/cksum/cksum-sha3.sh: New test, based on tests/cksum/b2sum.sh. * tests/local.mk (all_tests): Add the test. * bootstrap.conf: Add crypto/sha3. * gnulib: Update to latest commit. * NEWS: Mention the change. * doc/coreutils.texi (cksum general options): Mention sha3 as a supported argument to the -a option. Mention that 'cksum -a sha3' supports the --length option. Mention that SHA-3 is considered secure.
2025-08-30b2sum: --length: fix upper bound checkPádraig Brady1-0/+12
* src/digest.c (main): Don't saturate -l to BLAKE2B_MAX_LEN, so that the subsequent bounds check is performed. * tests/cksum/b2sum.sh: Add a test case. * NEWS: Mention the fix introduced in commit v9.5-71-gf2c84fe63
2025-07-26maint: avoid :> pattern in testsPádraig Brady1-1/+1
This was seen to trigger the EXIT trap on cygwin * cfg.mk (sc_prohibit_colon_redirection): Disallow all cases of :> in tests/ * tests/cksum/md5sum-bsd.sh: Adjust to avoid more stringent syntax check.
2025-07-26tests: avoid a false failure on CygwinCollin Funk1-1/+1
* tests/cksum/md5sum-bsd.sh: Use 'echo' instead of ':' to redirect to the file. Otherwise 'Exit $fail' is not called on Cygwin.
2025-02-17cksum: fix test for missingPaul Eggert1-1/+1
* tests/cksum/cksum.sh: Don’t output confusing diagnostic. Problem reported by Alyssa Ross (Bug#76360).
2025-01-01maint: update all copyright year number rangesPádraig Brady19-19/+19
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-11-02cksum: add support for --algorithm=crc32bPádraig Brady3-21/+24
$ echo -n '123456789' | cksum --raw -a crc32b | basenc --base16 CBF43926 * bootstrap.conf: Explicitly depend on the crc module. * doc/coreutils.texi (cksum): Add "crc32b" as an argument to -a. * src/cksum.c (crc32b_sum_stream): A new function similar to crc_sum_stream, but which does not include the length in the CRC calculation. * src/cksum.h: Add crc32b_sum_stream prototype. * src/digest.c: Add "crc32b" as an argument to -a. * tests/cksum/cksum.sh: Refactor to test both crc and crc32b. * tests/cksum/cksum-a.sh: Add "crc32b" case. * tests/cksum/cksum-base64.pl: Likewise. * tests/misc/read-errors.sh: Likewise. * NEWS: Mention the new feature.
2024-10-20tests: cksum: verify --check with commentsSylvestre Ledru1-3/+7
* tests/cksum/cksum-c.sh: Add a test case with a comment.
2024-07-02tests: fix improper use of grep -vPádraig Brady1-11/+11
* tests/cksum/cksum-c.sh: Remove improper use of `grep -v`.
2024-07-02tests: cksum: check when several files are missing or incorrectSylvestre Ledru1-0/+11
* tests/cksum/cksum-c.sh: Add test cases when several files with errors
2024-05-22tests: cksum: extend with --status, --ignore-missing and --warnSylvestre Ledru1-0/+58
* tests/cksum/cksum-c.sh: Add test cases for these option combinations.
2024-05-11tests: cksum: add incorrect data to verify --check & --strictSylvestre Ledru1-0/+29
* tests/cksum/cksum-c.sh: Add test cases.
2024-05-04cksum: add tests to verify the presence of "*"Sylvestre Ledru1-0/+7
* tests/cksum/cksum-a.sh: Add a test case.
2024-03-06cksum: ensure appropriate "binary" mode with --untaggedPádraig Brady1-0/+9
* src/digest.c (main): If --binary was enabled with a previous --tag, then reset the binary mode to auto select if --untagged then specified. * tests/cksum/cksum-a.sh: Add a test case.
2024-03-04cksum: consistently validate --length attributesPádraig Brady1-0/+4
* src/digest.c (main): Only validate the last used --length for being a multiple of 8. * tests/cksum/b2sum.sh: Add a test case. Fixes https://bugs.gnu.org/69546
2024-01-01maint: update all copyright year number rangesPádraig Brady19-19/+19
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2023-08-27tests: avoid false failure on cygwinPádraig Brady1-23/+25
* tests/cksum/md5sum-bsd.sh: Avoid part of test dealing with backslashes in file names, on systems where backslash is a directory separator. Issue reported by Bruno Haible on cygwin.
2023-08-27cksum: adjust tests and docs to binary mode handlingPádraig Brady2-3/+2
Following commit v9.3-80-g5e1e0993b which makes cksum match the output of the standalone utilities... * doc/coreutils.texi (cksum output modes): Remove the mention that cksum never outputs a binary indicator, as that's no longer the case. * tests/cksum/b2sum.sh: Avoid outputting a binary indicator. * tests/cksum/sm3sum.pl: Likewise.
2023-07-11cksum: escape filenames with a leading '\' in --check statusPádraig Brady1-3/+7
* src/digest.c (digest_check): Also escape in the case that the file name contains '\'. * tests/cksum/md5sum-bsd.sh: Add a test case. * doc/coreutils.texi (md5um invocation): Clarify escaping operation. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/64392
2023-07-09cksum: support transparent emulation of older utilsPádraig Brady2-19/+24
Support -b, --binary, and -t, --text to allow full emulation of older utilities with: exec cksum -a $algo --untagged "$@" Note this would diverge from OpenBSD's support of cksum -b. * src/digest.c: Change -b to mean --binary, not --base64 in all cases. Accept -b and -t in all cases. Keep --binary and --text undocumented for cksum. * tests/cksum/cksum-base64.pl: s/-b/--base64/. * tests/cksum/cksum-a.sh: Ensure cksum supports -b and -t appropriately. * NEWS: Mention the change in behavior.
2023-06-22b2sum: fix UAR with --check with malformed checksum linesPádraig Brady1-0/+5
* src/digest.c (split_3): Reinstate the check for whitespace after the digest portion of the line, so that we exit early before inspecting the file name which would be outside the passed buffer in the case where the input does not contain a newline. * tests/cksum/b2sum.sh: Add a test case. * NEWS: Mention the bug fix. * THANKS.in: Add Frank Busse who has reported multiple bugs using KLEE. Fixes https://bugs.gnu.org/64229
2023-06-19tests: move tests to a directory per utilitySylvestre Ledru19-0/+1794
* cfg.mk: Adjust syntax check exclusion paths. * tests/local.mk: Adjust for renamed tests.