rust-lang / rust-lang/rustup

Flaky has_local in rustup-init.sh

Open Beginner friendly
#5,009 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Verification
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
  1. Login to where /bin/sh has no builtin local
  2. Create an executable local in $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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.