From 73ac8e1044335d343188defc70a1c3a44980b50d Mon Sep 17 00:00:00 2001 From: Harini Date: Mon, 17 Aug 2026 12:51:02 +0530 Subject: [PATCH 1/2] fix: prevent has_local from finding external 'local' command via PATH On systems where /bin/sh has no builtin `local`, `has_local` would fall through and search $PATH for a command named `local`. If such a command existed there, it would be incorrectly used as the alias target. Fix by setting PATH= before the `local` call so that $PATH is not consulted for the fallback, matching the behavior on shells that have a builtin `local`. Fixes #5009 --- rustup-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 rustup-init.sh diff --git a/rustup-init.sh b/rustup-init.sh old mode 100755 new mode 100644 index d1e43f5378..a3a4d59266 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -14,7 +14,7 @@ # mksh has this alias by default. has_local() { # shellcheck disable=SC2034 # deliberately unused - local _has_local + PATH= local _has_local } has_local 2>/dev/null || alias local=typeset From 9495d64b585359eaf79f2cdd51919bed4a1efee4 Mon Sep 17 00:00:00 2001 From: Harini Date: Fri, 28 Aug 2026 09:44:21 +0530 Subject: [PATCH 2/2] fix: restore executable mode and suppress SC1007 in has_local rustup-init.sh was accidentally committed as 100644 (non-executable); restore it to 100755. shellcheck flags 'PATH= local _has_local' as SC1007 (space after =), but the space is intentional: PATH= is a POSIX command-prefix assignment, not a variable assignment, so suppress the warning. --- rustup-init.sh | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 rustup-init.sh diff --git a/rustup-init.sh b/rustup-init.sh old mode 100644 new mode 100755 index a3a4d59266..f2f2c79fc4 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -14,6 +14,7 @@ # mksh has this alias by default. has_local() { # shellcheck disable=SC2034 # deliberately unused + # shellcheck disable=SC1007 # PATH= is an intentional command prefix, not a bare assignment PATH= local _has_local }