From ae4792b64446068e504c69ff6786bfd04d0de801 Mon Sep 17 00:00:00 2001 From: Logic769 Date: Fri, 30 Oct 2026 03:18:39 +0800 Subject: [PATCH 1/2] join: let --nocheck-order after --check-order win --- src/uu/join/src/join.rs | 6 ++++-- tests/by-util/test_join.rs | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 0050bf0c32d..bfe58f11d8e 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -1016,13 +1016,15 @@ pub fn uu_app() -> Command { Arg::new("check-order") .long("check-order") .help(translate!("join-help-check-order")) - .action(ArgAction::SetTrue), + .action(ArgAction::SetTrue) + .overrides_with("nocheck-order"), ) .arg( Arg::new("nocheck-order") .long("nocheck-order") .help(translate!("join-help-nocheck-order")) - .action(ArgAction::SetTrue), + .action(ArgAction::SetTrue) + .overrides_with("check-order"), ) .arg( Arg::new("header") diff --git a/tests/by-util/test_join.rs b/tests/by-util/test_join.rs index 21334bd6b67..a7f6745d984 100644 --- a/tests/by-util/test_join.rs +++ b/tests/by-util/test_join.rs @@ -1038,3 +1038,14 @@ fn test_missing_key_is_empty_key() { .succeeds() .stdout_only("1002 bob\n"); } + +#[test] +fn test_last_of_check_order_nocheck_order_wins() { + let scene = TestScenario::new(util_name!()); + scene.fixtures.write("a.txt", "b\na\n"); + scene + .ucmd() + .args(&["--check-order", "--nocheck-order", "a.txt", "a.txt"]) + .succeeds() + .stdout_is("b\na\n"); +} From af51ec44c254a218b809384587b1ee878239353c Mon Sep 17 00:00:00 2001 From: Logic769 Date: Sat, 31 Oct 2026 09:23:37 +0800 Subject: [PATCH 2/2] join: cover the reverse flag order --- tests/by-util/test_join.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/by-util/test_join.rs b/tests/by-util/test_join.rs index a7f6745d984..b8952f73ffe 100644 --- a/tests/by-util/test_join.rs +++ b/tests/by-util/test_join.rs @@ -1048,4 +1048,11 @@ fn test_last_of_check_order_nocheck_order_wins() { .args(&["--check-order", "--nocheck-order", "a.txt", "a.txt"]) .succeeds() .stdout_is("b\na\n"); + + // The other order: --check-order wins and the unsorted input is reported. + scene + .ucmd() + .args(&["--nocheck-order", "--check-order", "a.txt", "a.txt"]) + .fails_with_code(1) + .stderr_is("join: a.txt:2: is not sorted: a\n"); }