Skip to content

bootstrap: fix inverted success check in PowerShell download fallback#157879

Open
SebTardif wants to merge 1 commit into
rust-lang:mainfrom
SebTardif:fix-powershell-download-fallback
Open

bootstrap: fix inverted success check in PowerShell download fallback#157879
SebTardif wants to merge 1 commit into
rust-lang:mainfrom
SebTardif:fix-powershell-download-fallback

Conversation

@SebTardif

@SebTardif SebTardif commented Jun 14, 2026

Copy link
Copy Markdown

When curl fails on Windows and bootstrap falls back to PowerShell for downloads, the success/failure check is inverted: the code returns early on failure (is_failure()) and prints "spurious failure, trying again" on success, then exits with code 1 after three successful downloads.

This was introduced in #141909 during the ExecutionContext refactoring. The original code used self.try_run(...) which returned bool (true = success). The refactoring changed the return type to CommandOutput but used is_failure() for the early-return check, inverting the logic.

The fix changes the check from is_failure() to is_success(), restoring the original behavior: return early when the download succeeds, retry when it fails.

When curl fails on Windows and bootstrap falls back to PowerShell for
downloads, the success/failure check is inverted. The code returns
early when PowerShell fails (`is_failure()`) and prints "spurious
failure, trying again" when PowerShell succeeds, then exits with
code 1 after three successful downloads.

This was introduced in rust-lang#141909 (bae39b8, 2025-06-07) during the
ExecutionContext refactoring. The original code used
`if self.try_run(...) { return; }` which returned a bool where
`true` meant success. The refactoring changed the return type to
`CommandOutput` but used `is_failure()` for the early return,
inverting the logic.

The fix changes the check from `is_failure()` to `is_success()`,
restoring the original behavior: return early when the download
succeeds, retry when it fails.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 14, 2026
@rustbot

rustbot commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @clubby789 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@rustbot

rustbot commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants