From 0635651bccba1f9367dd2f0de8dba8cb4f01d7ab Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Fri, 26 Jun 2026 15:28:33 +0900 Subject: [PATCH] coreutils: remove invalid fallback for symlinks from binary_path --- src/common/validation.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/common/validation.rs b/src/common/validation.rs index 124fa1dbb64..8214874c003 100644 --- a/src/common/validation.rs +++ b/src/common/validation.rs @@ -79,11 +79,8 @@ fn get_canonical_util_name(util_name: &str) -> &str { target_env = "musl" ))] pub fn binary_path(args: &mut impl Iterator) -> PathBuf { - match args.next() { - Some(ref s) if !s.is_empty() => PathBuf::from(s), - // the fallback is valid only for hardlinks - _ => std::env::current_exe().unwrap(), - } + PathBuf::from(args.next().unwrap()) + // no fallback for empty args. current_exe() (/proc/self/exe) is valid only for hardlinks } /// Get actual binary path from kernel, not argv0, to prevent `env -a` from bypassing /// AppArmor, SELinux policies on hard-linked binaries