Flaky has_local in rustup-init.sh
Open
Beginner friendly
Nobody has claimed this yet.
bug
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
On a system without local, it would continue searching in $PATH. If a such a command were found, that would wrongly be used throughout.
Steps
- Login to where
/bin/shhas no builtinlocal - Create an executable
localin$PATH
Possible Solution(s)
I don’t know how portable an empty path is, nor whether prepending it will affect searching for the following command on such a Shell. This should probably work anywhere:
has_local() {
# shellcheck disable=SC2034 # deliberately unused
PATH= local _has_local
}
Notes
No response
Rustup version
Reading latest script on GitHub.
Installed toolchains
Irrelevant, since I don’t have a Shell with no builtin `local`
OS version
Irrelevant, since I don’t have a Shell with no builtin `local`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open rustup-init.sh and locate has_local; first reproduce the case with a shell lacking builtin local and an executable named local on PATH. Verify the fix makes has_local test the shell builtin rather than the PATH command, then run the relevant shell checks if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100