diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 708596096..39b5a0a07 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -481,7 +481,8 @@ fn uu_app_opt_length(command: Command) -> Command { .long("length") .help("digest length in bits; must not exceed the max for the blake2 algorithm (512) and must be a multiple of 8") .value_name("BITS") - .value_parser(parse_bit_num), + .value_parser(parse_bit_num) + .overrides_with("length"), ) } diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index a3a5849ff..eed265ac5 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -180,6 +180,22 @@ fn test_check_b2sum_length_option_0() { .stdout_only("testf: OK\n"); } +#[test] +fn test_check_b2sum_length_duplicate() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.write("testf", "foobar\n"); + + scene + .ccmd("b2sum") + .arg("--length=123") + .arg("--length=128") + .arg("testf") + .succeeds() + .stdout_contains("d6d45901dec53e65d2b55fb6e2ab67b0"); +} + #[test] fn test_check_b2sum_length_option_8() { let scene = TestScenario::new(util_name!());