From c891d56fc1a3181dd1330069de033558c1851c01 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:56:25 +0900 Subject: [PATCH] coreutils: Let the name *utils valid --- src/bin/coreutils.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index caa23091ad2..0ea01c77899 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -52,14 +52,15 @@ fn main() { }); // binary name ends with util name? + let is_coreutils = binary_as_util.ends_with("utils"); let matched_util = utils .keys() - .filter(|&&u| binary_as_util.ends_with(u) && !binary_as_util.ends_with("coreutils")) - .max_by_key(|u| u.len()); //Prefer stty more than tty. coreutils is not ls + .filter(|&&u| binary_as_util.ends_with(u) && !is_coreutils) + .max_by_key(|u| u.len()); //Prefer stty more than tty. *utils is not ls let util_name = if let Some(&util) = matched_util { Some(OsString::from(util)) - } else if binary_as_util.ends_with("utils") || binary_as_util.ends_with("box") { + } else if is_coreutils || binary_as_util.ends_with("box") { // todo: Remove support of "*box" from binary uucore::set_utility_is_second_arg(); args.next()