coreutils
coreutils copied to clipboard
cksum: error handling deviation from GNU
cksum
's behavior when encountering directories or non existing files mismatches gnu implementation
$ cat <<EOF > CHECKSUM
SHA1 (dir) = ffffffffffffffffffffffffffffffffffffffff
SHA1 (not-file) = ffffffffffffffffffffffffffffffffffffffff
EOF
$ mkdir dir
$ ../../../gnu/src/cksum -c CHECKSUM
../../../gnu/src/cksum: dir: Is a directory
dir: FAILED open or read
../../../gnu/src/cksum: not-file: No such file or directory
not-file: FAILED open or read
../../../gnu/src/cksum: WARNING: 2 listed files could not be read
$ ../../target/debug/cksum -c CHECKSUM
../../target/debug/cksum: dir: Is a directory
../../target/debug/cksum: not-file: No such file or directory
not-file: FAILED open or read
../../target/debug/cksum: WARNING: 1 listed file could not be read
# With ignore missing
$ ../../../gnu/src/cksum -c CHECKSUM --ignore-missing
../../../gnu/src/cksum: dir: Is a directory
dir: FAILED open or read
../../../gnu/src/cksum: WARNING: 1 listed file could not be read
../../../gnu/src/cksum: CHECKSUM: no file was verified
$ ../../target/debug/cksum -c CHECKSUM --ignore-missing
../../target/debug/cksum: dir: Is a directory
../../target/debug/cksum: CHECKSUM: no file was verified