[PATCH] add a new unlzma applet

Rob Landley rob at landley.net
Sun Jan 22 00:38:39 UTC 2006


On Friday 20 January 2006 18:26, Aurelien Jacobs wrote:
> On Fri, 20 Jan 2006 12:39:53 -0600
>
> Rob Landley <rob at landley.net> wrote:
> > On Friday 20 January 2006 06:25, Aurelien Jacobs wrote:
> > > On Wed, 18 Jan 2006 00:46:18 -0600
> > >
> > > Rob Landley <rob at landley.net> wrote:
> > > > It's late enough I'm about to collapse but if I haven't applied your
> > > > patch by thursday remind me, ok?
> > >
> > > Beep.
> > > Reminder: patch still not applied :-)
> >
> > Continuing to test after checking in:
> > ./busybox tar tavf woot.sh
> > Segmentation fault
>
> I can't reproduce the segfault. Could you provide your woot.sh file ?

I don't seem to have it anymore, it was a random shell script to test 
something or other, which I had lying around in the directory.  I know it 
started with either #!/bin/sh or #!/bin/bash and two newlines.

> When I try this on random files, I generally get:
> tar: memory exhausted

That's still not a good error.

> The problem is that the lzma format contains nothing allowing to check
> if this is really an lzma file. Moreover, it don't contain any kind of
> CRC, so you can't verify that the decompression goes well and that there
> was no corruption.

That sucks pretty deeply.  If I'd known that, I wouldn't have merged it, and I 
strongly suspect it shouldn't be usable from tar until that's fixed somehow.  

Any compression format worth its' salt will have about 4 bytes of identifier 
magic somewhere and a CRC-32.  If they can't go at the beginning then they 
can be _appended_ to the file.  (For example, stick a CRC32 at the end 
followed by the ascii string "LZMA" xored with 0xFFFFFFFF.)

I didn't look too closely at the algorithm itself before because I didn't 
expect to have time to work through the math.  Now the first thing I'm 
noticing is the profound lack of comments.  Could you add a few comments to 
decompress_unlzma.c?

> Still, here is a patch which will allow to detect all those "memory
> exhausted" cases, and thus detect most of the non lzma files.

Well, that's an improvement.

> > Wanna take a look at that?  (In the absence of compression support, I
> > don't have any valid lzma archives to feed it...)
>
> If you want to try lzma compression, download the lzma SDK, unpack, and
> cd C/7zip/Compress/LZMA_Alone/; make -f makefile.gcc

Does it have any kind of identifier on the files it creates?  (Anything the 
"file" command could latch onto to identify the thing?)

> Aurel

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list