pierrec / lz4

LZ4 compression and decompression in pure Go
BSD 3-Clause "New" or "Revised" License
878 stars 142 forks source link

commit bc1239b broke decompressing legacy-compressed bytes in normal mode #203

Open hugelgupf opened 1 year ago

hugelgupf commented 1 year ago

Patch with test to reproduce: https://gist.github.com/hugelgupf/fc7ea7c735017acfbcad61ef36632d55

Before commit bc1239b it was possible to compress using legacy mode, and decompress using the normal reader. After the commit, not possible anymore. I wrote a test case based on some tests failing in other repos. I'm not exactly sure if this is supposed to be supported or possible, or even really used, but my coworkers wrote a test case for it here.

I applied the above patch and git bisected from v4.1.14 to v4.1.17. bc1239b is what fell out.

It seems like the decoding is not broken, but the encoding in legacy mode is given the commit that broke things. So technically speaking, our use case in u-root is still working, just the test is broken for the time being.

lizthegrey commented 1 year ago

It looks like this is what is causing TestWriterLegacy tests to fail, yeah?

yup, sure enough, reverting bc1239ba9073d34e1c5cc25110deb212d3e72526 causes tests to succeed again.