Skip to content
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

Consider Cleanup Operations #5

Open
mitsuhiko opened this issue May 18, 2023 · 1 comment
Open

Consider Cleanup Operations #5

mitsuhiko opened this issue May 18, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mitsuhiko
Copy link
Owner

mitsuhiko commented May 18, 2023

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_replace on 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_delete can leave both the current exe dangling (__relocated__) as well as the garbage collection binary (__selfdelete__)
    • self_replace has all the issues of self_delete but 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.

@mitsuhiko mitsuhiko added the enhancement New feature or request label May 18, 2023
@mitsuhiko
Copy link
Owner Author

On windows an option would be to give the files some really unique names and then use MOVEFILE_DELAY_UNTIL_REBOOT so they are eventually cleaned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant