Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/busybox/files: busybox-1.21.0-xz.patch busybox-1.21.0-platform.patch
Date: Sun, 03 Mar 2013 01:43:31
Message-Id: 20130303014259.D6C7D2171E@flycatcher.gentoo.org
1 vapier 13/03/03 01:42:59
2
3 Added: busybox-1.21.0-xz.patch
4 busybox-1.21.0-platform.patch
5 Log:
6 Fix applying of patches pointed out by Markos Chandras.
7
8 (Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key FB7C4156)
9
10 Revision Changes Path
11 1.1 sys-apps/busybox/files/busybox-1.21.0-xz.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/busybox/files/busybox-1.21.0-xz.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/busybox/files/busybox-1.21.0-xz.patch?rev=1.1&content-type=text/plain
15
16 Index: busybox-1.21.0-xz.patch
17 ===================================================================
18 --- busybox-1.21.0/archival/libarchive/decompress_unxz.c
19 +++ busybox-1.21.0-xz/archival/libarchive/decompress_unxz.c
20 @@ -40,6 +40,7 @@ static uint32_t xz_crc32(const uint8_t *
21 IF_DESKTOP(long long) int FAST_FUNC
22 unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
23 {
24 + enum xz_ret xz_result;
25 struct xz_buf iobuf;
26 struct xz_dec *state;
27 unsigned char *membuf;
28 @@ -63,9 +64,8 @@ unpack_xz_stream(transformer_aux_data_t
29 /* Limit memory usage to about 64 MiB. */
30 state = xz_dec_init(XZ_DYNALLOC, 64*1024*1024);
31
32 + xz_result = X_OK;
33 while (1) {
34 - enum xz_ret r;
35 -
36 if (iobuf.in_pos == iobuf.in_size) {
37 int rd = safe_read(src_fd, membuf, BUFSIZ);
38 if (rd < 0) {
39 @@ -73,28 +73,57 @@ unpack_xz_stream(transformer_aux_data_t
40 total = -1;
41 break;
42 }
43 + if (rd == 0 && xz_result == XZ_STREAM_END)
44 + break;
45 iobuf.in_size = rd;
46 iobuf.in_pos = 0;
47 }
48 + if (xz_result == XZ_STREAM_END) {
49 + /*
50 + * Try to start decoding next concatenated stream.
51 + * Stream padding must always be a multiple of four
52 + * bytes to preserve four-byte alignment. To keep the
53 + * code slightly smaller, we aren't as strict here as
54 + * the .xz spec requires. We just skip all zero-bytes
55 + * without checking the alignment and thus can accept
56 + * files that aren't valid, e.g. the XZ utils test
57 + * files bad-0pad-empty.xz and bad-0catpad-empty.xz.
58 + */
59 + do {
60 + if (membuf[iobuf.in_pos] != 0) {
61 + xz_dec_reset(state);
62 + goto do_run;
63 + }
64 + iobuf.in_pos++;
65 + } while (iobuf.in_pos < iobuf.in_size);
66 + }
67 + do_run:
68 // bb_error_msg(">in pos:%d size:%d out pos:%d size:%d",
69 // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size);
70 - r = xz_dec_run(state, &iobuf);
71 + xz_result = xz_dec_run(state, &iobuf);
72 // bb_error_msg("<in pos:%d size:%d out pos:%d size:%d r:%d",
73 -// iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, r);
74 +// iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, xz_result);
75 if (iobuf.out_pos) {
76 xwrite(dst_fd, iobuf.out, iobuf.out_pos);
77 IF_DESKTOP(total += iobuf.out_pos;)
78 iobuf.out_pos = 0;
79 }
80 - if (r == XZ_STREAM_END) {
81 - break;
82 + if (xz_result == XZ_STREAM_END) {
83 + /*
84 + * Can just "break;" here, if not for concatenated
85 + * .xz streams.
86 + * Checking for padding may require buffer
87 + * replenishment. Can't do it here.
88 + */
89 + continue;
90 }
91 - if (r != XZ_OK && r != XZ_UNSUPPORTED_CHECK) {
92 + if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) {
93 bb_error_msg("corrupted data");
94 total = -1;
95 break;
96 }
97 }
98 +
99 xz_dec_end(state);
100 free(membuf);
101
102
103
104
105 1.1 sys-apps/busybox/files/busybox-1.21.0-platform.patch
106
107 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/busybox/files/busybox-1.21.0-platform.patch?rev=1.1&view=markup
108 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/busybox/files/busybox-1.21.0-platform.patch?rev=1.1&content-type=text/plain
109
110 Index: busybox-1.21.0-platform.patch
111 ===================================================================
112 --- busybox-1.21.0/archival/libarchive/decompress_unxz.c
113 +++ busybox-1.21.0-platform/archival/libarchive/decompress_unxz.c
114 @@ -30,8 +30,8 @@ static uint32_t xz_crc32(const uint8_t *
115 /* We use arch-optimized unaligned accessors */
116 #define get_unaligned_le32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_LE32(v); })
117 #define get_unaligned_be32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_BE32(v); })
118 -#define put_unaligned_le32(val, buf) move_to_unaligned16(buf, SWAP_LE32(val))
119 -#define put_unaligned_be32(val, buf) move_to_unaligned16(buf, SWAP_BE32(val))
120 +#define put_unaligned_le32(val, buf) move_to_unaligned32(buf, SWAP_LE32(val))
121 +#define put_unaligned_be32(val, buf) move_to_unaligned32(buf, SWAP_BE32(val))
122
123 #include "unxz/xz_dec_bcj.c"
124 #include "unxz/xz_dec_lzma2.c"
125 --- busybox-1.21.0/include/platform.h
126 +++ busybox-1.21.0-platform/include/platform.h
127 @@ -228,7 +228,7 @@ typedef uint32_t bb__aliased_uint32_t FI
128 # define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
129 # define move_to_unaligned16(u16p, v) do { \
130 uint16_t __t = (v); \
131 - memcpy((u16p), &__t, 4); \
132 + memcpy((u16p), &__t, 2); \
133 } while (0)
134 # define move_to_unaligned32(u32p, v) do { \
135 uint32_t __t = (v); \