From 6cde13e75a655d3f9d5d032273fc8a6a08bc7bcf Mon Sep 17 00:00:00 2001 From: mattsu Date: Fri, 23 Jan 2026 08:33:04 +0900 Subject: [PATCH] fix(sort): skip ordering incompatibility check when --key is specified Previously, the ordering_incompatible check was performed unconditionally, causing errors even when the --key option was used, where such incompatibilities might not apply. This change adds a condition to skip the check if --key is present, ensuring correct behavior for key-based sorting. --- src/uu/sort/src/sort.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 135177b48..cbde70a3f 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -2081,7 +2081,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let ignore_non_printing = matches.get_flag(options::IGNORE_NONPRINTING); let ignore_case = matches.get_flag(options::IGNORE_CASE); - if ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing) { + if !matches.contains_id(options::KEY) + && ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing) + { let opts = ordering_opts_string( mode_flags, dictionary_order,