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

exit code of lz4 --test for invalid file is non-zero #1045

Closed
anatol opened this issue Dec 3, 2021 · 3 comments · Fixed by #1058
Closed

exit code of lz4 --test for invalid file is non-zero #1045

anatol opened this issue Dec 3, 2021 · 3 comments · Fixed by #1058

Comments

@anatol
Copy link

anatol commented Dec 3, 2021

lz4 --version
*** LZ4 command line interface 64-bits v1.9.3, by Yann Collet ***

at Arch Linux.

I have an invalid file produced by golang lz4 library (see anatol/booster#117 for reference). I check it with lz4 command and it complains

$ lz4 --test invalid.lz4
Stream followed by undecodable data at position 8 
invalid.lz4          : decoded 0 bytes    
$ echo $?
0

the exit code of this command is 0 (i.e. success). It sounds wrong to me.

The exit code should indicate an error and be non-zero.

@Cyan4973
Copy link
Member

Cyan4973 commented Dec 3, 2021

If it's very small we could use it as golden file for regression tests (or a close enough equivalent).

That it fails at position 8 looks strange to be fair. Sounds like a skippable frame.

@anatol
Copy link
Author

anatol commented Dec 3, 2021

Here is the first 4K of broken legacy lz4 file produced by lz4.go library.

https://drive.google.com/file/d/1ROna4lr8S06EdoVXEVzWXRbO_AdENHa5/view?usp=sharing

If you run lz4 --test for it the exit code would be 0 which looks wrong

$ lz4 --test test.lz4
Stream followed by undecodable data at position 8 
test.lz4             : decoded 0 bytes                                         
$ echo $?
0

@anatol
Copy link
Author

anatol commented Dec 3, 2021

And the lz4.go issue is tracked here pierrec/lz4#156

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

Successfully merging a pull request may close this issue.

2 participants