[PATCH 0/2] Autodetect the compress (.Z) algorithm

Thiago Jung Bauermann bauerman at linux.vnet.ibm.com
Thu Apr 23 19:03:00 UTC 2015


Hello,

I set out to fix the following bug:

$ ./busybox zcat /tmp/a.Z
zcat: no gzip/bzip2/xz magic

In the process I found out that bzcat.tests has code to test gzip compression, but doesn't 
use it. So I fixed that, with an eye to extend the file to support testing .Z compression as 
well.

That is done in the first patch. Since it changes indentation, it's a bit hard to see what was 
actually changed. I'm attaching here a version of the patch which ignores whitespace 
changes to make review easier.

The second patch adds detection of compress magic so that autodetecting .Z archives 
work.

The result is:

$ ../busybox zcat /tmp/a.Z
Hooray
$ ./runtest bzcat
PASS: zcat: dont delete gz src
PASS: zcat: dont delete bz2 src
PASS: zcat: dont delete Z src
PASS: bzcat can print many files
PASS: bzcat can handle compressed zero-length bzip2 files
PASS: zcat can print many files
PASS: zcat can handle compressed zero-length compressed (.Z) files


Regards,
Thiago Jung Bauermann
IBM Linux Technology Center




Thiago Jung Bauermann (2):
  bzcat.tests: Fix to run both gz and bz2 tests.
  Auto-detect .Z files as well.

 archival/libarchive/open_transformer.c |  7 ++++
 testsuite/bzcat.tests                  | 74 +++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 24 deletions(-)

-- 
1.9.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20150423/2dcee458/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-1-no-whitespace.patch
Type: text/x-patch
Size: 1041 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20150423/2dcee458/attachment.bin>


More information about the busybox mailing list