-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow self renamer to work if tempdir is on a different device #797
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #797 +/- ##
========================================
- Coverage 6.81% 2.29% -4.52%
========================================
Files 37 30 -7
Lines 11820 4566 -7254
========================================
- Hits 806 105 -701
+ Misses 11014 4461 -6553 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your contributing to Topgrade!
I wonder can we do std::fs::copy(); std::fs::remove_file()
here?
It would be possible to use this, but |
Yeah, that is one benefit of May I step back a little bit, and ask you what is the functionality of this From my understanding, the renamer itself is simply doing a round-trip, I do not quite get why it is necessary on Windows. |
@SteveLauC The self-renamer is supposed to make self-upgrades on Windows work because executable files are locked while they are running and cannot be changed. That likely means that Looking at the surrounding code, this doesn't clean up the old executable on exit in the case of upgrade. With this new case using the binary directory, leaving the temporary executable in-place should be avoided, so I will convert this PR to a draft. |
b4372ee
to
d1e5373
Compare
Executable cleanup is now implemented via the The clippy issues seem to be unrelated, but I can add fixes for those if preferred. |
Standards checklist:
CONTRIBUTING.md
cargo build
)cargo fmt
)cargo clippy
)cargo test
)For new steps
--dry-run
option works with this step--yes
option works with this step if it is supported bythe underlying command
Currently, the self renamer fails with the following error if the tempdir is on a different device from the system temporary directory:
This PR works around this by using a temporary file in the binary directory instead in that case.
If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.