Untangling tar...

Rob Landley rob at landley.net
Thu Dec 15 07:15:10 UTC 2005

On Tuesday 13 December 2005 15:46, Glenn L. McGrath wrote:

> Some basics about tar
> The archive creation and archive extraction have completly different
> backends, they do share some code at the front related to argument
> parsing.

I noticed.  (We have a lot of recursive descent-and-match code, not just the 
archivers but also find, ls -R, and various "should support" things like grep 
-r.  Heck, switch_root and mdev -s both do it.  It'd be nice if it was all 
generic, somehow, but that'll take some thought.)

> In the config section for tar some options may only work in extraction
> and not creation.
> The archive creation code dates back to when Bruce Perens was hacking
> on busybox.


> I worked on most of the archive extaction code and placed any
> common extraction code in libunarchive, so if you touch stuff in
> libunarchive expect it to effect multiple applets. The whole point of
> libunarchive is to share the same code that is needed to extract
> different formats.

I noticed again.  Still trying to wrap my brain around it...

> It was my intention that when i got the extraction code to a state that
> i was happy with to go back and apply the same principles to archive
> creation. That hasnt happened.

You've seen my own todo list of doom, haven't you? :)

> It should be possible to add tar.bz2 creation without touching anything
> in libunarchive, perhaps a seperate config option should be made for
> bz2 creation to seperate it from libunarchiving code.

I've got a patch here somewhere that makes extract and unextract fork and pipe 
stuff through bzip or gzip (using the internal copy if there is one, but 
still via fork and run_applet_by_name or whatever that is).  Pretty darn 
simple, really.

> I will have a bit of a look and see what i can work out.

I'm not personally worry about this until the 1.2 timeframe.  For 1.1, the 
things that need fixing for tar are the bugs from the bug list, namely:

547  tar archive corruption when packing unreadable files
  Two fixes: get the error code right and check access _before_ writing the

408  tar.c and init.c error - small patch
  probably already fixed, but make sure.

347  tar: Decompression failed returns exit status 0 even error happened

169  "tar" with a directory argument doesn't extract the directory recursively
  Yes, although this one's actual work.

Some of these may already have been fixed, and some have patches in the 
relevant bugs.busybox.net entry, but I haven't tested them yet.  Any of these 
you feel up to tackling, I'd be immensely greatful.  (Means I don't have to 
do it. :)

> Glenn

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