Repository navigation
Stage Windows self-updates before replacing uv.exe - #20855
DebadityaHait wants to merge 2 commits into
Conversation
| #[cfg(not(windows))] | ||
| let installer_install_prefix = install_prefix.as_path(); | ||
| #[cfg(windows)] | ||
| let installer_config_path = Some(temporary_config_dir.path()); |
There was a problem hiding this comment.
pointing XDG_CONFIG_HOME at a TempDir means the installer writes uv-receipt.json into a directory that gets deleted on drop, so %LOCALAPPDATA%\uv\uv-receipt.json still holds the pre-update receipt after a windows self-update (version, bins, binary_aliases all stale). copying it back verbatim would be wrong since install_prefix points at the temp dir, but leaving it entirely untouched means a release that adds a new binary never shows up in the receipt. intentional?
There was a problem hiding this comment.
I addressed the receipt-staleness concern. After the staged binaries are installed, I now copy the staged receipt back to the original receipt location, replace its temporary install_prefix with the actual install location, and restore modify_path to the user’s existing setting. I also added regression coverage for this behavior, and CI is passing.
77e107d to
8d9324a
Compare
|
We support using AI (i.e., LLMs) while coding. However, AI should not be used to communicate with maintainers. Please read and follow our AI policy when submitting issues and pull requests. |
### Summary
Fix Windows self-updates so an interrupted or failed installation does not leave
uvunusable.Instead of renaming the current
uv.exebefore running the installer, the updater now stages the new release in a temporary directory. The existing executable remains in place until installation completes successfully, after whichuvreplaces itself using the Windows-safe self-replacement mechanism.Addresses #12142.
Changes
Install the new release into a temporary directory before replacing the running executable.
Keep the existing
uv.exein place while the external installer runs.Replace
uv.exefrom the staged copy only after installation succeeds.Copy companion binaries from the temporary installation into the existing executable directory.
Run the temporary installer with:
Preserve the existing install receipt and shell configuration.
Configure the updater child process to terminate when the parent task is interrupted.
Remove the previous flow that renamed
uv.exeto.previous.exebefore installation.The old flow could leave the canonical executable missing when an update was interrupted. With this change, failed or interrupted installations leave the existing
uv.exeavailable.Testing
Added a Windows regression test that:
The regression test failed against the previous implementation and passes with this change.
Validation completed locally:
Not run locally:
These are best covered by CI.