cscott / compressjs

Pure JavaScript de/compression (bzip2, etc) for node.js, volo, and the browser.
GNU General Public License v2.0
352 stars 41 forks source link

Problem with compress.js Bzip2 compress #4

Open NealRame opened 10 years ago

NealRame commented 10 years ago

Hello,

When I try to decompress data compressed with compressjs using bunzip2 I got an error. However I can decompress my data using compressjs.

Environment:

>>> compressjs -t bzip2 data > data.bz2
>>> bunzip2 data.bz2

bunzip2: Data integrity error when decompressing.
        Input file = data.dmg.bz2, output file = data.dmg

It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.

You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.

bunzip2: Deleting output file data.dmg, if it exists.

>>> bunzip2 -tvv data.bz2
  data.dmg.bz2: 
    [1: huff+mtf rt+rld]
    [2: huff+mtf rt+rld]
    [3: huff+mtf rt+rlddata integrity (CRC) error in data

You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
cscott commented 10 years ago

That's pretty interesting. Does this happen on all data, or only on a specific file? If the latter, can you upload the data file somewhere? (or create a pull request with your data in test/ and I'll add it to the test suite)

I'd also be interested in the output of bunzip2 --version, so I can try to reproduce with exactly the same bunzip2 version.

NealRame commented 10 years ago

It does not happen on all data. I was trying to decompress a 'dmg' volume template (compressed with compressjs) when it happened. However, I think I found a way to easly reproduce the issue :

>>> hdiutil create -srcFolder tmp -volname data -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW -size 1073741824 data.dmg
>>> compressjs -t bzip2 data.dmg > data.bz2
>>> bunzip2 data.bz2
>>> bunzip2 --version
bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.

   Copyright (C) 1996-2010 by Julian Seward.

   This program is free software; you can redistribute it and/or modify
   it under the terms set out in the LICENSE file, which is included
   in the bzip2-1.0.6 source distribution.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   LICENSE file for more details.

bunzip2: I won't read compressed data from a terminal.
bunzip2: For help, type: `bunzip2 --help'.
cscott commented 10 years ago

I don't have easy access to a MacOS machine. Could you upload that data.dmg file here: https://drive.google.com/folderview?id=0B8W6mwX2ny6uaGwzWF9yem5xZ00&usp=sharing

Thanks.

NealRame commented 10 years ago

Hello, I share data.dmg.bz2 with you (compressed using compressjs -t bzip2) on google drive. I had the same error message when trying to unzip on linux with bunzip2 version 1.0.6.

cscott commented 9 years ago

It's possible this bug has been fixed via https://github.com/cscott/compressjs/commit/e400f5156317bb77cc78eb0d2dbcd460b0087348 or https://github.com/cscott/compressjs/commit/f744c804132cd850e5ef507d95d08f287b5fb290

shrinandhini2801 commented 7 years ago

Can you help me with a sample snippet of converting a bz2.zip file that comes from a webservice ?. I need to handle this web service and convert that to a json format.