Panic when no URLs are listed for `pkg.rust` in manifest
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Problem
I'm doing some work with slightly-modified manifests, and have run into a panic in Rustup that I wasn't expecting. It turns out that if you remove both url and xz_url from [pkg.rust.target.x86_64-unknown-linux-gnu] (or whatever your target may be), then any component-adding function (e.g., rustup component add rust-src) crashes here: https://github.com/rust-lang/rustup/blob/ce5817a94ac372804babe32626ba7fd2d5e1b6ac/src/toolchain.rs#L682
This is particularly odd since rustup never actually tries to download the rust binary artifacts, it just uses that pkg to figure out which components exist.
Steps
- Set up a mirror for
https://static.rust-lang.org/dist/. - Make the mirror modify
channel-rust-stable.tomlso thatpkg.rust.target.*has nourlorxz_urlfield. - Make the mirror generate updated
.sha256and.ascfiles (with its own keypair). - Invoke
rustup component add rust-srcwithRUSTUP_DIST_SERVERandRUSTUP_PGP_KEYset for the mirror.
Possible Solution(s)
The absence of the (unused) binary artifacts for pkg.rust should not be used to indicate whether or not the various sub-components are available.
Notes
It's not entirely clear why this panic is triggered, since the components are all still there, but it seems something somewhere is ignoring components for packages that have no binary artifacts. I suspect it's related to
https://github.com/rust-lang/rustup/blob/ce5817a94ac372804babe32626ba7fd2d5e1b6ac/src/dist/manifest.rs#L454-L456
but can't figure out where bins being empty is actually relevant. I'm guessing it's somehow
https://github.com/rust-lang/rustup/blob/ce5817a94ac372804babe32626ba7fd2d5e1b6ac/src/dist/manifest.rs#L489-L491>
but can't tie it back to the code in get_component_suggestion.
Rustup version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.58.1 (db9d1b20b 2022-01-20)`
Installed toolchains
Default host: x86_64-unknown-linux-gnu
rustup home: /home/jongje/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
beta-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.58.1 (db9d1b20b 2022-01-20)
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
Reproduce the manifest setup from the issue, then inspect src/toolchain.rs at get_component_suggestion and the related logic in src/dist/manifest.rs, especially the handling of empty bins. Done means component operations no longer panic when pkg.rust has no url or xz_url, while the listed sub-components remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100