Skip to content

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

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
SebTardif:fix-powershell-download-fallback
Jun 16, 2026
Merged

bootstrap: fix inverted success check in PowerShell download fallback#157879
rust-bors[bot] merged 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.

@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

This comment has been minimized.

@clubby789

Copy link
Copy Markdown
Contributor

Would you remind removing the commit description? It's very verbose for a one-line change that's fairly self evident. Otherwise r=me

@SebTardif

This comment was marked as low quality.

@clubby789

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 893a9f8 has been approved by clubby789

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 15, 2026
@clubby789

clubby789 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

I guess this code hasn't been hit much; it seems surprising this wasn't noticed before

@ChrisDenton

Copy link
Copy Markdown
Member

The chances of both curl and powershell failing are pretty slim. I guess the exception being if there's a genuine connection error but then the user would still see the download failed (via the progress message). They'd just get an unhelpful "file not found" error afterwards when bootstrap tries to move the downloaded file.

rust-bors Bot pushed a commit that referenced this pull request Jun 16, 2026
Rollup of 6 pull requests

Successful merges:

 - #157707 (Introduce `-Z lint-rust-version`)
 - #157748 (rustc_public: make sure hidden fields have their accessors)
 - #157831 (test `carryless_mul` codegen)
 - #157879 (bootstrap: fix inverted success check in PowerShell download fallback)
 - #157933 (Use constant for detecting thin pointer formatting)
 - #157934 (update AttributeTemplate docs)
@rust-bors rust-bors Bot merged commit 515e693 into rust-lang:main Jun 16, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 16, 2026
rust-timer added a commit that referenced this pull request Jun 16, 2026
Rollup merge of #157879 - SebTardif:fix-powershell-download-fallback, r=clubby789

bootstrap: fix inverted success check in PowerShell download fallback

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants