Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/uucore/src/lib/features/checksum/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,7 @@ fn process_checksum_file(
// not a single line correctly formatted found
// return an error
if res.total_properly_formatted() == 0 {
if opts.verbose.over_status() {
log_no_properly_formatted(filename_display());
}
log_no_properly_formatted(filename_display());
return Err(FileCheckError::Failed);
}

Expand Down
17 changes: 17 additions & 0 deletions tests/by-util/test_b2sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ fn test_check_b2sum_length_option_8() {
.stdout_only("testf: OK\n");
}

#[test]
fn test_check_b2sum_status_reports_no_properly_formatted_lines() {
let invalid_checksum = concat!(
"bedfbb90d858c2d67b7ee8f7523be3d3b54004ef9e4f02f2",
"ad79a1d05bfdfe49b81e3c92ebf99b504102b6bf003fa342",
"587f5b3124c205f55204e8c4b4ce7d7c",
);

new_ucmd!()
.arg("-c")
.arg("--status")
.pipe_in(invalid_checksum)
.fails()
.no_stdout()
.stderr_contains("b2sum: 'standard input': no properly formatted checksum lines found");
}

#[test]
fn test_invalid_b2sum_length_option_not_multiple_of_8() {
let scene = TestScenario::new(util_name!());
Expand Down
Loading