Closed charlesw1234 closed 8 years ago
I am sorry but in this moment I don't have enough time to spend on PySquashfsImage development. However if you (or anyone else) will contribute I will be happy to include the change to the main stream of the project. I would suggest to share your code and post a link where everyone can download it.
Hi, the problem occurs because the fragments are being read incorrectly. Change in def read_fragment_table(self,myfile):
ofs = 0
while ofs<len(table) :
entry = _Squashfs_fragment_entry()
ofs = entry.fill(table,ofs)
entry.fragment = self.read_data_block(myfile,entry.start_block,entry.size)
self.fragment_table.append(entry)
Also added reading and parsing the compression options block (right after superblock). Can make a pull request with my changes (not done yet) if wanted.
After this fix LZMA decompressor can be used just like so:
def uncompress(self, src):
import lzma
return lzma.decompress(src)
Yes! please make a pull request and I will merge your patches with the lzma support ;-)
@BotoX would be great if you could send a pull request
Thanks @matteomattei
you are welcome! ;-)
I have try to include the decompressor by using python-lzma, but it seems not worked. And then I add a new python function decompress0 by call of lzma_stream_buffer_decode as the xz_wrapper.c in squashfs-tools. But the call of decompress still failed with format error (lzma error code = 7). So I think this may be caused by unsupported new format of squashfs. Can you update PySquashfsImage to support the new squashfs with more stronger compression? The squashfs which I'm using can be provided, and my modification about PySquashfsImage, lzma.c in python-lzma can be provided too.