-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
(un)zstd deletes files it shouldn't #1082
Comments
Indeed, thanks for reporting @pdknsk . This is related to the use of This situation happens because We'll have to reverse the logic to avoid this issue. |
I only used |
Another scenario when the file shouldn't be deleted, caused by the same problem. $ touch FILE FILE.zst
$ unzstd -f FILE.zst
zstd: FILE.zst: unexpected end of file
$ ls FILE
ls: cannot access FILE: No such file or directory |
Also for
|
All these scenarios have a same root cause, opening destination file before source file. However, scenario 2 is bit more complex, because source file exists, but is malformed. That would delay opening destination file to way later in the decoding process, something that the current framework doesn't allow easily. Therefore, I'll concentrate first on fixing cases 1 and 3. |
Would there be anything wrong with creating temporary files and moving (-f) them afterwards or deleting them upon error? Seems to me that it solve all the issues, but is there something I am missing? slow in some systems? portability? Thanks for the advice. |
I guess it would work @eyherabh . On the negative side, it's a little bit of extra work for the file system. More importantly, during operation, you would have both Also, note that |
I'm surprised by this statement @pdknsk .
The original file is still there. |
Yes, I meant when the user confirms to overwrite (delete in this case). |
when source file does not exist (#1082)
if source file does not exist (#1082)
This happens with any suffix
zstd
knows.The text was updated successfully, but these errors were encountered: