bootstrap: fix inverted success check in PowerShell download fallback#157879
Conversation
|
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 (
Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Would you remind removing the commit description? It's very verbose for a one-line change that's fairly self evident. Otherwise r=me |
This comment was marked as low quality.
This comment was marked as low quality.
|
@bors r+ rollup |
|
I guess this code hasn't been hit much; it seems surprising this wasn't noticed before |
|
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. |
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)
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.
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
ExecutionContextrefactoring. The original code usedself.try_run(...)which returnedbool(true = success). The refactoring changed the return type toCommandOutputbut usedis_failure()for the early-return check, inverting the logic.The fix changes the check from
is_failure()tois_success(), restoring the original behavior: return early when the download succeeds, retry when it fails.