Skip to content

feat(self-update): use DownloadCfg for self-updates - #5190

Merged
rami3l merged 7 commits into
rust-lang:mainfrom
rami3l:refactor/dl-cfg-self-update
Nov 4, 2026
Merged

rami3l merged 7 commits into
rust-lang:mainfrom
rami3l:refactor/dl-cfg-self-update

Conversation

@rami3l

@rami3l rami3l commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Closes #5188 via reusing the infrastructure provided by DownloadCfg for self-updates, which now handles various common concerns such as retrying and hash checking.

This patch adds a requirement for the release server to store rustup-init[.EXE].sha256 files as well, which our official server already ships today. By falling back to the old logic only when .sha256 returns 404, this design should be a good compromise between compatibility and convenience.

Concerns

@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch 3 times, most recently from 36863b0 to ef5f89f Compare November 4, 2026 09:20
@rami3l
rami3l marked this pull request as ready for review November 4, 2026 09:20
@rami3l
rami3l requested a review from djc November 4, 2026 09:22
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch from ef5f89f to 1d18057 Compare November 4, 2026 09:28
@rami3l
rami3l requested a lite review from Copilot November 4, 2026 09:30

@djc djc left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/dist/download.rs Resolved

Copilot AI left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A moderate active finding remains because malformed or truncated mirror hash responses can panic during self-update instead of returning a normal download error.

1 open issue
What changed in this PR

This pull request routes rustup self-update downloads through DownloadCfg, adding checksum verification, resumable downloads, shared retry handling, and a 404-only fallback for mirrors without .sha256 files.

Changes:

  • Added checksum-aware, retryable self-update downloads with compatibility fallback.
  • Centralized retry configuration and download behavior in DownloadCfg.
  • Updated test fixtures and self-update tests for checksum files and missing-checksum behavior.

Open review findings:

  • Moderate (2 votes): Validate malformed or truncated .sha256 responses before slicing to avoid a panic.
  • Moderate (1 vote): Add integration coverage for checksum-integrity failures.
  • Moderate (1 vote): Add end-to-end coverage for resuming an interrupted self-update download.
File Description
tests/​suite/​cli_self_upd.rs Adds coverage for missing checksum files and clarifies self-update test names.
src/​test/​clitools.rs Generates .sha256 files for self-update test fixtures.
src/​download/​mod.rs Exposes DownloadError for checksum fallback handling.
src/​dist/​manifestation.rs Reuses shared retry behavior for component downloads.
src/​dist/​download.rs Adds shared retry configuration and retrying download support.
src/​cli/​self_update.rs Uses checksum-based DownloadCfg downloads with retrying and a 404 compatibility fallback.

Review effort: Lite

View changes since this review

Comment thread src/cli/self_update.rs Resolved
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch 2 times, most recently from 20f39dd to 2ec5a2a Compare November 4, 2026 09:40
@rami3l
rami3l requested a review from djc November 4, 2026 10:04
Comment thread src/dist/download.rs Resolved
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch 6 times, most recently from 2a0c9b9 to fc842d3 Compare November 4, 2026 10:51
@rami3l
rami3l requested a review from djc November 4, 2026 10:52
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch 2 times, most recently from c99dd93 to 4a4775a Compare November 4, 2026 12:23
This feature adds a requirement for the release server to store
`rustup-init[.EXE].sha256` files as well, which our official server
already ships today. By falling back to the old logic only when
`.sha256` returns 404, this design should be a good compromise between
compatibility and convenience.
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch from 4a4775a to e18222e Compare November 4, 2026 12:27
@rami3l
rami3l force-pushed the refactor/dl-cfg-self-update branch from e18222e to 9c377e7 Compare November 4, 2026 12:39
@rami3l
rami3l enabled auto-merge November 4, 2026 12:41
@rami3l
rami3l added this pull request to the merge queue Nov 4, 2026
Merged via the queue into rust-lang:main with commit 0eafe77 Nov 4, 2026
29 checks passed
@rami3l
rami3l deleted the refactor/dl-cfg-self-update branch November 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support proper download resumption during self-update

3 participants