From 472b56f0ff62d41b0bb55976d3476ca1ae84f1cf Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Fri, 1 Mar 2024 12:18:26 +0100 Subject: [PATCH] cat: fix -b and -n anti-symmetry --- src/uu/cat/src/cat.rs | 3 ++- tests/by-util/test_cat.rs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 7b8b69119..8823f27b8 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -250,7 +250,8 @@ pub fn uu_app() -> Command { .short('b') .long(options::NUMBER_NONBLANK) .help("number nonempty output lines, overrides -n") - .overrides_with(options::NUMBER) + // Note: This MUST NOT .overrides_with(options::NUMBER)! + // In clap, overriding is symmetric, so "-b -n" counts as "-n", which is not what we want. .action(ArgAction::SetTrue), ) .arg( diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 4956114bd..1fd829ed9 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -438,7 +438,6 @@ fn test_non_blank_overrides_number() { } #[test] -#[ignore = "known issue"] fn test_non_blank_overrides_number_even_when_present() { new_ucmd!() .args(&["-n", "-b", "-n"])