1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

du: don't panic on block-size 0

This commit is contained in:
Ben Wiederhake 2025-04-12 22:51:09 +02:00
parent e1645bb9e2
commit a82dce0bd7
2 changed files with 27 additions and 5 deletions

View file

@ -1248,3 +1248,19 @@ fn test_du_no_deduplicated_input_args() {
.collect();
assert_eq!(result_seq, ["2\td", "2\td", "2\td"]);
}
#[test]
fn test_du_blocksize_zero_do_not_panic() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.write("foo", "some content");
for block_size in ["0", "00", "000", "0x0"] {
ts.ucmd()
.arg(format!("-B{block_size}"))
.arg("foo")
.fails()
.stderr_only(format!(
"du: invalid --block-size argument '{block_size}'\n"
));
}
}