Please honour CARGO_NET_OFFLINE for implicit installs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Steps
- Don't have
+nightly-2023-12-19installed - In any project,
CARGO_NET_OFFLINE=true cargo +nightly-2023-12-19 check --locked --offline
Expected behaviour
Error message saying +nightly-2023-12-19 is not installed, mentioning CARGO_NET_OFFLINE
Actual behaviour
Starts to download the requested toolchain.
Discussion
CARGO_NET_OFFLINE is a way that cargo has provided for some time now to allow disabling network access. This can be very useful in a number of circumstances.
A user might set this because:
- The network is unavailable or very slow and they don't want to wait for it to time out
- The network is very expensive, or rationed, so they need to control downloads
- They want to prevent downloads for security or software-supply-chain reasons
See also #4264. I'm hoping that honouring CARGO_NET_OFFLINE will be uncontroversial, and won't be blocked on those wider discussions.
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 command from the issue with an uninstalled nightly toolchain and compare the offline behavior with the normal implicit-install path. Trace the rustup command entry point that handles the requested toolchain and determine where CARGO_NET_OFFLINE should prevent downloading. Done means the command reports that the toolchain is not installed, mentions CARGO_NET_OFFLINE, and does not start a download.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100