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

Zstd CLI destroys input when the input file is the same as the output file #1422

Closed
rjoursler opened this issue Nov 21, 2018 · 0 comments
Closed
Labels

Comments

@rjoursler
Copy link

Running zstd filename -o filename deletes the contents of the file before erroring. Because compressed files are normally saved with a format specific extension, I see no reason to support this kind of operation. To prevent inadvertent data loss, the CLI should error before the file contents are deleted though.

@Cyan4973 Cyan4973 added the bug label Nov 21, 2018
terrelln added a commit to terrelln/zstd that referenced this issue Dec 18, 2018
Compare the input and output files by their inode number and
refuse to open the output file if the input file is the same.

This doesn't work when (de)compressing multiple files to a single
file, but that is a very uncommon use case, mostly used for
benchmarking by me.

Fixes facebook#1422.
@Cyan4973 Cyan4973 mentioned this issue Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants