[PATCH] Tar with transformer (gzip, bzip2, ...) on NOMMU

Alex Landau landau_alex at yahoo.com
Wed Sep 5 11:12:33 UTC 2007


Hi,

The attached patch makes "tar -xzf" work on NOMMU.

- The main part is the open_transformer function that instead of forking and running a
"transformation" function (that should decompress the archive), vforks and execs the
appropriate decompressor.
- A bit of preprocessor magic (include/unarchive.h) removes the unused arguments at the
time of call (the transformer function is unused on NOMMU, and the external helper to
exec is unused on MMU).
- Changed components and how thorough they were tested:
  * tar -xzf - fullly tested on MMU and NOMMU.
  * tar -xjf - same.
  * tar -xaf (LZMA) - same.
  * LZMA (archival/bbunzip.c) - added -f option (same meaning as for gunzip).
      It was present in the usage message, seems to be implemented by the
      common function bbunpack(), but just was not passed to getopt32().
  * tar -xZf (uncompress) - compile-tested only (both MMU and NOMMU).
      I don't have .Z files to test on... Should work as long as uncompress can be
      invoked as "uncompress -cf -".
  * rpm - compile-tested on both MMU and NOMMU. Sort of runtime tested on MMU.
      I downloaded an rpm file and ran ./busybox rpm -i <the-file>.rpm. It
      complained that it can't create some file under /etc. That's normal since
      I'm not root. The files it tried to create have the correct names, so it should
      work (tm).
- The patch should change nothing on MMU machines. Someone using rpm and compress, please
verify that...
- gzip, bzip2 and lzma work for me on NOMMU (and on MMU too, of course).
- The patch touches quite a lot of files, but the changes are minor in most cases (except
open_transformer that is at the core). Diffstat below.

 archival/bbunzip.c                          |    2 +-
 archival/libunarchive/Kbuild                |    1 -
 archival/libunarchive/get_header_tar_bz2.c  |    2 +-
 archival/libunarchive/get_header_tar_gz.c   |    9 ++++++++-
 archival/libunarchive/get_header_tar_lzma.c |    2 +-
 archival/libunarchive/open_transformer.c    |   22 +++++++++++++++++++++-
 archival/rpm.c                              |   26 +++++++++++++++++++++++---
 archival/tar.c                              |    2 +-
 include/unarchive.h                         |    6 ++++++
 9 files changed, 62 insertions(+), 10 deletions(-)

Thanks,
Alex


       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tar-nommu.diff
Type: text/x-patch
Size: 8102 bytes
Desc: 803123106-tar-nommu.diff
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070905/71018977/attachment-0002.bin 


More information about the busybox mailing list