mitsuhiko / mitsuhiko/self-replace
Consider Cleanup Operations
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 823
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
The crate currently does not attempt to clean up temporary files left behind in some circumstances. Situations where files could be left behind:
Unix:
self_replaceon Unix writes one temporary file next to the executable under a temporary name to support an atomic write. There is no API I'm aware of that would make it possible to avoid this issue.
Windows:
- In general all operations on windows can lose files, but in most cases those files are left in a temporary folder. Only if the temporary folder is not on the same value as the target exe, then files can be left over. In case a temporary folder cannot be used:
self_deletecan leave both the current exe dangling (__relocated__) as well as the garbage collection binary (__selfdelete__)self_replacehas all the issues ofself_deletebut top of that the atomic write and rename file (__temp__) can be lost like on unix
For operations outside of a protected folder (self_delete_outside_path) the temporaries can be left in another location than the one of the executable.
All these losses are guarded and will only happen on killing the process or shutting down the machine.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the self_replace, self_delete, and self_delete_outside_path operations, including the relocated, selfdelete, and temp temporary names described in the issue. Compare the Unix and Windows failure cases, then define cleanup behavior for each guarded shutdown or process-termination scenario. Done means the listed temporary files are cleaned up where possible without breaking the existing atomic replacement and deletion operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100