Skip to content

Fix the cargo-binstall self-update that can never succeed on Windows - #5380

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/cargo-binstall-self-update
Sep 16, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/cargo-binstall-self-update

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request introduces improved handling for the installation and update of the cargo-binstall package in the Cargo package manager integration. The main change ensures that when cargo-binstall is updating or installing itself, the system will automatically retry the operation using the standard cargo install command if the initial attempt with cargo-binstall fails. Additionally, new tests have been added to verify this logic and other related behaviors.

Cargo package manager improvements:

  • Added logic in CargoPkgOperationHelper to detect when cargo-binstall is installing or updating itself and, on failure, automatically retry the operation using the standard cargo install command instead of cargo-binstall. This prevents issues with self-updates that can fail due to file locks or permission errors. [1] [2] [3] [4] [5]

  • Introduced a new option Cargo_DoNotUseBinstall in the OverridenInstallationOptions struct to control whether cargo-binstall should be used for a particular package operation, and updated the ToString() method to include this option. [1] [2]

Testing enhancements:

  • Added a comprehensive test suite in CargoOperationHelperTests to verify the new retry logic, parameter construction, and to ensure that retrying is not performed in brokered operations or for other packages.

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

The fallback silently discards custom installation locations, potentially updating the wrong executable.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Improves Cargo’s cargo-binstall self-update recovery by retrying locally through cargo install.

Changes:

  • Adds self-install/update detection and fallback behavior.
  • Adds an override flag and regression tests.
File summaries
File Description
CargoOperationHelperTests.cs Tests fallback and broker behavior.
CargoPkgOperationHelper.cs Implements self-update retry logic.
OverridenInstallationOptions.cs Adds the binstall bypass flag.
Review details

Suppressed comments (1)

src/UniGetUI.PackageEngine.Managers.Cargo/Helpers/CargoPkgOperationHelper.cs:62

  • The update fallback also loses options.CustomInstallLocation. Since Cargo_DoNotUseBinstall makes hasBinstall false, lines 87-88 no longer append the selected location and cargo install targets the default Cargo home; the retry may report success while leaving the custom-location executable unchanged. Preserve that destination with an appropriate Cargo mapping/staging step, or do not auto-retry this case.
                else if (targetsBinstallItself)
                    parameters = ["install", package.Id, "--locked", "--force"];
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

🟢 Approval recommended

The fallback is bounded, preserves existing custom-path behavior, and has comprehensive tests.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "35f736a0-b1ca-11f1-812d-df653807bf9d",
	"headSha": "9db3a5f69d3ab0090274703bff36a6b21b761608",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 2bda171 into main Sep 16, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/cargo-binstall-self-update branch September 16, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Updating cargo-binstall through UniGetUI can never succeed on Windows (binary replaces itself)

2 participants