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 provides no output when it can't create destination file #231

Closed
chipturner opened this issue Jul 1, 2016 · 7 comments
Closed

Comments

@chipturner
Copy link
Contributor

When trying to compress a file that a user doesn't have permission to, or on a read-only filesystem, or possibly other cases, zstd fails and correctly returns 1 but provides no diagnostics. Example as non-root user:

$ gzip /etc/passwd; echo $?
gzip: /etc/passwd.gz: Permission denied
1
$ zstd /etc/passwd; echo $?
1
@Cyan4973
Copy link
Contributor

Cyan4973 commented Jul 1, 2016

Possibly related to #232 , which also detects something and exits silently.

@Cyan4973
Copy link
Contributor

Cyan4973 commented Jul 1, 2016

Latest update in "dev" branch will now answer :

$ zstd /etc/passwd; echo $?
zstd: /etc/passwd.zst: cannot open 
1

It's not the same error message as spelled by gzip though,
it just understands it cannot create destination file, it doesn't analyze further.

@chipturner
Copy link
Contributor Author

Would it be possible to get the error message from the OS? This is an improvement but that would be ideal.

@Cyan4973
Copy link
Contributor

Cyan4973 commented Jul 1, 2016

That's a good idea. But how to do that ?

@chipturner
Copy link
Contributor Author

It depends on the API you're using; it would typically be from strerror after the open/fopen fails

@Cyan4973
Copy link
Contributor

Cyan4973 commented Jul 1, 2016

Indeed, it works !

./zstd /etc/passwd; echo $?
zstd: /etc/passwd.zst: Permission denied 
1

Thanks for the hint !

@Cyan4973
Copy link
Contributor

Cyan4973 commented Jul 3, 2016

Fixed in v0.7.2

@Cyan4973 Cyan4973 closed this as completed Jul 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants