facebook / facebook/zstd

Should zstd delete incomplete archives?

Open
#4,007 5 comments 3 reactions 1 assignee Claimed by @Cyan4973 View on GitHub
enhancement
Dominant language
C
Stars
27.9k
Forks
2.6k
Avg merge
1d 3h
Merged PRs (30d)
8

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.