[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#686502: pxz produces archives broken for busybox's unxz



On Fri, 2012-12-21 at 14:34 +0100, Abou Al Montacir wrote:
> > Add stream padding as specified in the spec.
> I'll provide a new patch for eating zeros and fixing issue pointed by Michael

Please find attached new patch handling padding and fixing issue
highlighted by Michael,

Cheers,

diff -Nru busybox-1.20.0/debian/changelog busybox-1.20.0/debian/changelog
--- busybox-1.20.0/debian/changelog	2012-09-20 08:32:55.000000000 +0200
+++ busybox-1.20.0/debian/changelog	2012-12-21 21:59:39.000000000 +0100
@@ -1,3 +1,10 @@
+busybox (1:1.20.0-7.1) unstable; urgency=low
+
+  * Fix decompression of multi stream XZ compressed files
+    (Closes: Bug#bug#686502)
+
+ -- Abou Al Montacir <abou.almontacir@sfr.fr>  Thu, 21 Dec 2012 22:00:00 +0100
+
 busybox (1:1.20.0-7) unstable; urgency=low
 
   * set CONFIG_FEATURE_COPYBUF_KB from 4 to 64 for all flavours.  This
diff -Nru busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch
--- busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch	1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch	2012-12-21 19:23:12.000000000 +0100
@@ -0,0 +1,25 @@
+Author: Abou Al Montacir <abou.almontacir@sfr.fr>
+Purpose: Fix decompression of multi stream XZ compressed files
+ (Closes: bug#686502)
+
+--- busybox-1.20.0~/archival/libarchive/decompress_unxz.c	2012-12-20 21:51:04.000000000 +0100
++++ busybox-1.20.0/archival/libarchive/decompress_unxz.c	2012-12-20 21:49:11.000000000 +0100
+@@ -87,7 +87,17 @@ unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
+ 			iobuf.out_pos = 0;
+ 		}
+ 		if (r == XZ_STREAM_END) {
+-			break;
++			if (iobuf.in_pos != iobuf.in_size) {
++				// Initialize decoder for new stream
++				xz_dec_end(state);
++				state = xz_dec_init(XZ_DYNALLOC, 64*1024*1024);
++				// Eat padding
++				while (iobuf.in[iobuf.in_pos] == 0){
++					iobuf.in_pos += 1;
++				}
++			}
++			// Look for other streams
++			continue;
+ 		}
+ 		if (r != XZ_OK && r != XZ_UNSUPPORTED_CHECK) {
+ 			bb_error_msg("corrupted data");
diff -Nru busybox-1.20.0/debian/patches/series busybox-1.20.0/debian/patches/series
--- busybox-1.20.0/debian/patches/series	2012-09-19 22:58:00.000000000 +0200
+++ busybox-1.20.0/debian/patches/series	2012-12-20 21:54:21.000000000 +0100
@@ -25,3 +25,6 @@
 dont-force-no-alignment-for-s390.patch
 
 stop-checking-ancient-kernel-version.patch
+
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686502
+fix-unxz-with-multiple-streams.patch

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: