kubo / snzip

Snzip, a compression/decompression tool based on snappy
Other
217 stars 30 forks source link

Streaming writes in framing2-format not supported #28

Closed dpq closed 2 years ago

dpq commented 2 years ago

Hi,

Currently snzip lacks the ability to decompress files written with snappy.NewBufferedWriter() streaming writer. Upon reading the header of the next snappy frame it throws an error:

framing2-format.c:227: Unsupported identifier 0x73.

Other tools like python-snappy have been verified to work with this format correctly.

kubo commented 2 years ago

Hi @dpq,

Could you post a reproducible example? How did you compress and decompress files?

I did the following on Ubuntu 20.04. It works fine.

$ pip3 install --user python-snappy  # install python-snappy
$ echo Hello World | python3 -m snappy -c > hello-world.sz     # compress by python-snappy
$ file hello-world.sz   # verify that the file format is snappy framed.
hello-world.sz: snappy framed data
$ cat hello-world.sz | ./snzip -d   # uncompress by snzip
Hello World
dpq commented 2 years ago

Hi, I can post a sample in a bit but the gist of it is that I had sort of like several snappy files concatenated to each other due to an error on my part. I.e. snzip was balking at the second frame's header's "s" character (sNaPpy).

kubo commented 2 years ago

Thanks. I confirmed that snzip failed to decompress a concatenated file

$ echo Hello World | python3 -m snappy -c > hello-world.sz
$ cat hello-world.sz hello-world.sz > hello-world-concatenated.sz
$ cat hello-world-concatenated.sz | python3 -m snappy -d
Hello World
Hello World
$ cat hello-world-concatenated.sz | ./snzip -d
Hello World
Unsupported identifier 0x73
kubo commented 2 years ago

This issue was fixed by b607e60. I'll release 1.0.5 before this weekend.