Skip to content

Comments

Improve logs when recovering from an interrupted installation#4725

Draft
FranciscoTGouveia wants to merge 1 commit intorust-lang:mainfrom
FranciscoTGouveia:logs-interruped-install
Draft

Improve logs when recovering from an interrupted installation#4725
FranciscoTGouveia wants to merge 1 commit intorust-lang:mainfrom
FranciscoTGouveia:logs-interruped-install

Conversation

@FranciscoTGouveia
Copy link
Contributor

@FranciscoTGouveia FranciscoTGouveia commented Feb 20, 2026

Related to #4724.

Currently, when a toolchain installation is retried after being interrupted, an excessive number of warnings are emitted.

This patch detects that situation, skips the redundant warnings, and prints a single, more informative message instead.

I would appreciate any feedback on the wording of the new message.


For reference, I leave below the before and after:

Before:

$ rustup toolchain install 1.90 --no-self-update
info: syncing channel updates for 1.90-x86_64-unknown-linux-gnu
info: latest update on 2025-09-18 for version 1.90.0 (1159e78c4 2025-09-14)
info: removing previous version of component rustc
warn: component rustc not found during uninstall
info: removing previous version of component cargo
warn: component cargo not found during uninstall
info: removing previous version of component rust-std
warn: component rust-std not found during uninstall
info: removing previous version of component rust-docs
warn: component rust-docs not found during uninstall
info: removing previous version of component rustfmt
warn: component rustfmt not found during uninstall
info: removing previous version of component clippy
warn: component clippy not found during uninstall
info: downloading 6 components
        rustc installed                       78.70 MiB
        cargo installed                       10.18 MiB
     rust-std installed                       27.77 MiB
    rust-docs installed                       20.49 MiB
      rustfmt installed                        2.15 MiB
       clippy installed                        4.33 MiB
  1.90-x86_64-unknown-linux-gnu installed - rustc 1.90.0 (1159e78c4 2025-09-14)

After:

$ rustup toolchain install 1.90 --no-self-update
info: syncing channel updates for 1.90-x86_64-unknown-linux-gnu
info: latest update on 2025-09-18 for version 1.90.0 (1159e78c4 2025-09-14)
info: recovering from a partially installed toolchain
info: downloading 6 components
        rustc installed                       78.70 MiB
        cargo installed                       10.18 MiB
     rust-std installed                       27.77 MiB
    rust-docs installed                       20.49 MiB
      rustfmt installed                        2.15 MiB
       clippy installed                        4.33 MiB
  1.90-x86_64-unknown-linux-gnu installed - rustc 1.90.0 (1159e78c4 2025-09-14)

@FranciscoTGouveia FranciscoTGouveia changed the title fix(toolchain): improve logs when recovering from an interrupted inst… Improve logs when recovering from an interrupted installation Feb 20, 2026
for component in update.components_to_uninstall {
// If there are no components installed, we don't need to keep
// checking, we can simply exit the loop earlier.
if self.installation.list()?.is_empty() {
Copy link
Member

Choose a reason for hiding this comment

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

I think in principle this fix is correct, thanks!

However, isn't .list() doing a FS read every time in this loop? I'd imagine the result of .installation.list() to be perfectly predictable (don't care about ToC/ToU for now), so may I ask what do we have in .components_to_uninstall and .installation.list() here?

In other words, could these be two sets of elements of the same format, so that we can make a difference?

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.

2 participants