-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Should zstd delete incomplete archives? #4007
Comments
Agreed, this would be a desirable behavior |
We already have some code which is supposed to remove the destination file when an error happens : Why is it not active in the reported scenario is unclear. To be investigated. |
Confirmed : |
The error is triggered in the recent-ish Essentially, the program terminates execution immediately. The expected cleaner behavior is that the code must fail, and return with an error to the main Another alternative could be to trap program termination and implement some kind of cleaning there, but I'm even more concerned about increasing bug-producing surface and how ugly code could become. |
Indeed, it's not straightforward to propagate an error signal throughout the |
Is your feature request related to a problem? Please describe.
The last issue related to #4005 and maybe the most debatable.
When the disk fills up during compression, the resulting archive will be corrupt. It's kept by zstd and not deleted.
That gives a false sense of security and may evoke some annoying post-processing to find and remove corrupt archives.
To me, corrupt archives have no benefit as long as the source file still exists (which must be checked prior to archive deletion).
Describe the solution you'd like
zstd should remove corrupt archives it produces.
Make it an instant operation to check that the archive is corrupt (maybe by altering a critical checksum/flag in the first bytes of the archive). Currently, zstd will notice the corruption as a premature end (which is good), but is has to read the whole archive for that. That's unnecessary.
Describe alternatives you've considered
Keep the current behavior, that is however one probable cause for issues #4005 and #4006.
Additional context
None.
The text was updated successfully, but these errors were encountered: