mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
* cksum: stops when one of given files doesn't exist #5809 * removed printld cksum: stops when one of given files doesn't exist #5809 * formatting the code cksum: stops when one of given files doesn't exist #5809 * formatting the code cksum: stops when one of given files doesn't exist #5809 * set exist status cksum: stops when one of given files doesn't exist #5809 * code quality formatting issue cksum: stops when one of given files doesn't exist #5809 * tertsdiepraam idea cksum: stops when one of given files doesn't exist #5809 * one new test case and deleted duplicate show cksum: stops when one of given files doesn't exist #5809 * formatting the test cases cksum: stops when one of given files doesn't exist #5809 * Revert "formatting the test cases cksum: stops when one of given files doesn't exist #5809" This reverts commit 8c382f1e8fa4e9ba3fc0f4fc05ee2fb58ef9dbfd. * reverting the changes and committing again due to a mistake cksum: stops when one of given files doesn't exist #5809 --------- Co-authored-by: biplab5464 <biplab5464@outlook.com>
This commit is contained in:
parent
6d5f2e4129
commit
076b905513
2 changed files with 23 additions and 2 deletions
|
@ -168,8 +168,13 @@ where
|
|||
} else if filename.is_dir() {
|
||||
Box::new(BufReader::new(io::empty())) as Box<dyn Read>
|
||||
} else {
|
||||
file_buf =
|
||||
File::open(filename).map_err_context(|| filename.to_str().unwrap().to_string())?;
|
||||
file_buf = match File::open(filename) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
show!(err.map_err_context(|| filename.to_string_lossy().to_string()));
|
||||
continue;
|
||||
}
|
||||
};
|
||||
Box::new(file_buf) as Box<dyn Read>
|
||||
});
|
||||
let (sum, sz) = digest_read(&mut options.digest, &mut file, options.output_bits)
|
||||
|
|
|
@ -80,6 +80,22 @@ fn test_nonexisting_file() {
|
|||
.stderr_contains(format!("cksum: {file_name}: No such file or directory"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_one_nonexisting_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
at.touch("abc.txt");
|
||||
at.touch("xyz.txt");
|
||||
|
||||
ucmd.arg("abc.txt")
|
||||
.arg("asdf.txt")
|
||||
.arg("xyz.txt")
|
||||
.fails()
|
||||
.stdout_contains_line("4294967295 0 xyz.txt")
|
||||
.stderr_contains("asdf.txt: No such file or directory")
|
||||
.stdout_contains_line("4294967295 0 abc.txt");
|
||||
}
|
||||
|
||||
// Make sure crc is correct for files larger than 32 bytes
|
||||
// but <128 bytes (1 fold pclmul) // spell-checker:disable-line
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue