tags:

views:

272

answers:

1

I had mounted a fusecompress of directory compressed/ at fusecompress/ I copied a large file (several GB) to the fusecompress directory (ok, I mv'd it). The compressed file in the directory compressed/ is length 1,221,396,660. However, I cannot remove/uncompress the file. fusecompress has a memory error: "Cannot allocate memory".

Is there anyway to utilize the lzo library to write a decompress routine for the compressed file?

I tried the following, but got a segmentation fault:

    char buffer[OUT_LEN];
    char outbuffer[IN_LEN];
    int read;
    lzo_uint writ;
    unsigned long totalWrit = 0;

    while( (read = fread( buffer, sizeof(char), OUT_LEN, stdin )) > 0 )
    {
            r = lzo1x_decompress( buffer, read, outbuffer, &writ, NULL );
            fwrite( outbuffer, sizeof(char), writ, stdout );
            totalWrit += writ;
    }

    fprintf( stderr, "\nDone. %d bytes written out.\n\n", totalWrit );

Update:

In response to bill, the first 160 bytes of the file are:

00000000  01 1f 01 5d ff 89 04 00  a2 20 85 04 30 6e ba 48  |...]..... ..0n.H|
00000010  00 00 01 02 00 00 00 00  00 00 11 3c 3c 3c 20 53  |...........<<< S|
00000020  75 6e 20 56 69 72 74 75  61 6c 42 6f 78 20 44 69  |un VirtualBox Di|
00000030  73 6b 20 49 6d 61 67 65  20 3e 3e 3e 0a 00 3b 00  |sk Image >>>..;.|
00000040  00 08 7f 10 da be 01 00  01 00 90 01 00 54 00 3b  |.............T.;|
00000050  a8 00 20 c9 70 00 02 02  00 00 00 a2 2d b8 03 6c  |.. .p.......-..l|
00000060  02 a9 02 80 a9 01 10 b4  01 00 15 28 00 00 52 08  |...........(..R.|
00000070  00 00 a4 15 30 3e 76 22  73 4c 96 3d bf 8f ca 66  |....0>v"sL.=...f|
00000080  a8 93 2b a6 83 65 44 4d  37 41 a4 02 ca bb 56 4e  |..+..eDM7A....VN|
00000090  a9 e9 b0 05 39 14 00 05  04 00 00 ff 00 00 00 3f  |....9..........?|
A: 

You must look how the file was compressed. Witch Header and additional data are stored in the file.

bill
I posted the header of the file. Is 160 bytes enough?
maxwellb
sorry, but fusecompress is available as source code. You can look athttp://code.google.com/p/fusecompress/ and see how the files are compressed or decompressed.
bill
i'll try that. thanks. Asked here in case someone had encountered that before.
maxwellb