rustup: rust-analyzer fallback recursively executes Homebrew wrapper #7111
Unanswered
tamird
asked this question in
Everyday usage
Replies: 1 comment
|
Have you tried reporting this upstream? They're in a better position to comment on fixes for this than Homebrew is. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description of issue
When Homebrew's rustup wrapper is first in PATH and the active toolchain has no rust-analyzer component,
rust-analyzer --versionrepeatedly falls back to that same wrapper and exits witherror: infinite recursion detected. A working standalone Homebrew rust-analyzer is later in PATH at/opt/homebrew/bin/rust-analyzer.The expected behavior is to skip the rustup proxy and run the standalone analyzer.
This reproduces with Homebrew 7.0.8 and rustup 1.29.1, the current rustup formula version. The installed standalone analyzer is Homebrew's 2026-09-28 build.
brew updateupdated Homebrew and the public taps but exited unsuccessfully because of authentication for an unrelated private tap.brew doctorreports an unrelated unlinked keg. This is being reported in Discussions because the homebrew-core issue checklist cannot truthfully be completed.The diagnostics and this report were prepared by OpenAI Codex (GPT-6) at the reporter's request.
Reproduction
With the Homebrew
rustupandrust-analyzerformulae installed, and an active toolchain without the rust-analyzer component:The command resolves to
/opt/homebrew/opt/rustup/bin/rust-analyzer. The active toolchain isstable-aarch64-apple-darwin (default). Installed components:Complete failing command output, exit status 1:
Running the standalone analyzer directly succeeds, exit status 0:
Cause and controlled comparison
The rustup formula's
env_script_all_filescall creates this shell wrapper at/opt/homebrew/opt/rustup/bin/rust-analyzer:The underlying proxy resolves to
/opt/homebrew/Cellar/rustup/1.29.1/libexec/bin/rustup. The wrapper and that executable are different files.Rustup's fallback implementation excludes PATH candidates by comparing their file identity with
env::current_exe(). It therefore accepts the shell wrapper as an external analyzer, executes it, and re-enters the proxy.As a controlled comparison, executing the underlying proxy with Homebrew's fallback-settings environment preserved and only the wrapper directory removed from the child PATH succeeds:
( export RUSTUP_OVERRIDE_UNIX_FALLBACK_SETTINGS=/opt/homebrew/etc/rustup/settings.toml export PATH="$(printf '%s' "$PATH" | tr ':' '\n' | awk '$0 != "/opt/homebrew/opt/rustup/bin"' | paste -sd ':' -)" /opt/homebrew/opt/rustup/libexec/bin/rust-analyzer --version )Output, exit status 0:
Related wrapper behavior is discussed in discussion 7086; that thread concerns caller-selected
argv[0]rather than this fallback recursion.Output of
brew configLocal proxy configuration is redacted.
Output of
brew doctorThe unrelated formula's name is redacted. No ownership or linking changes were made.
All reactions