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
Differences between gzip and zstd #854
Comments
|
First of all: thanks for writing zstd. I'm amazed by speed and compression ratio! Very nice! Please feel free to close this ticket. My two observations are only minor nitpicks and it's perfectly fine if you decide not to do anything.
They use open() instead of fopen() - and thus can control the permission bits of the output file. |
Right, I believe
Technically, we also occasionally use some OS-dependent interfaces, when there is no standard-C equivalent. In such case, we try to write several variants to support multiple targets, and for unsupported ones, relevant functionalities are disabled cleanly (they tend to be non-essential). |
Now, pressing Ctrl-C during compression or decompression will erase operation artefact (unfinished destination file) before leaving execution.
After learning a bit more about it, it appears function In latest |
zstd on Linux: two observations
If I start gzip to compress a large file and if I kill gzip using ^C, gzip will delete the output file before terminating. zstd currently doesn't do that. I think gzip's behavior is better, because it's better to have no output file than to have an incomplete or corrupted output file.
When compressing or decompressing a file, zstd uses the system call below to create the output file (from strace):
open("file.zst", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
gzip and xz use similar system calls, but they use mode 0600. They switch the mode of the output file to the desired mode after the file was closed. Is there a reason why zstd uses 0666? I think 0600 would be better: don't allow read access to other users before the file is ready.
The text was updated successfully, but these errors were encountered: