-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
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.