Package: busybox / 1:1.22.0-9+deb8u1

update-deb-format-support.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Description: Add support for latest .deb format members
 This adds support for control.tar, control.tar.xz, data.tar, data.tar.xz
 and data.tar.lzma in the dpkg and dpkg-deb applet. It also removes support
 for control.tar.bz2 which has never been supported.
 .
 This should make these applets conform to deb(5).
Author: Guillem Jover <guillem@debian.org>
Origin: vendor
Forwarded: no
Last-Update: 2014-07-30
Bug-Debian: http://bugs.debian.org/756462
---
 archival/dpkg.c                                   |   12 ++++++++++--
 archival/dpkg_deb.c                               |    6 ++++++
 archival/libarchive/Kbuild.src                    |    1 +
 archival/libarchive/filter_accept_list_reassign.c |   11 +++++++++++
 archival/libarchive/get_header_tar_xz.c           |   21 +++++++++++++++++++++
 include/bb_archive.h                              |    1 +
 6 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 archival/libarchive/get_header_tar_xz.c

diff --git a/archival/dpkg.c b/archival/dpkg.c
index 2893cfc..71eae66 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1472,11 +1472,12 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
 	tar_handle->src_fd = ar_handle->src_fd;
 
 	/* We don't care about data.tar.* or debian-binary, just control.tar.* */
+	llist_add_to(&(ar_handle->accept), (char*)"control.tar");
 #if ENABLE_FEATURE_SEAMLESS_GZ
 	llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
 #endif
-#if ENABLE_FEATURE_SEAMLESS_BZ2
-	llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
+#if ENABLE_FEATURE_SEAMLESS_XZ
+	llist_add_to(&(ar_handle->accept), (char*)"control.tar.xz");
 #endif
 
 	/* Assign the tar handle as a subarchive of the ar handle */
@@ -1492,12 +1493,19 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
 	tar_handle->src_fd = ar_handle->src_fd;
 
 	/* We don't care about control.tar.* or debian-binary, just data.tar.* */
+	llist_add_to(&(ar_handle->accept), (char*)"data.tar");
 #if ENABLE_FEATURE_SEAMLESS_GZ
 	llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
 #endif
+#if ENABLE_FEATURE_SEAMLESS_XZ
+	llist_add_to(&(ar_handle->accept), (char*)"data.tar.xz");
+#endif
 #if ENABLE_FEATURE_SEAMLESS_BZ2
 	llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
 #endif
+#if ENABLE_FEATURE_SEAMLESS_LZMA
+	llist_add_to(&(ar_handle->accept), (char*)"data.tar.lzma");
+#endif
 
 	/* Assign the tar handle as a subarchive of the ar handle */
 	ar_handle->dpkg__sub_archive = tar_handle;
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 13f9db9..48920f6 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -70,10 +70,16 @@ int dpkg_deb_main(int argc, char **argv)
 	ar_archive->dpkg__sub_archive = tar_archive;
 	ar_archive->filter = filter_accept_list_reassign;
 
+	llist_add_to(&ar_archive->accept, (char*)"data.tar");
+	llist_add_to(&control_tar_llist, (char*)"control.tar");
 #if ENABLE_FEATURE_SEAMLESS_GZ
 	llist_add_to(&ar_archive->accept, (char*)"data.tar.gz");
 	llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
 #endif
+#if ENABLE_FEATURE_SEAMLESS_XZ
+	llist_add_to(&ar_archive->accept, (char*)"data.tar.xz");
+	llist_add_to(&control_tar_llist, (char*)"control.tar.xz");
+#endif
 #if ENABLE_FEATURE_SEAMLESS_BZ2
 	llist_add_to(&ar_archive->accept, (char*)"data.tar.bz2");
 	llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
diff --git a/archival/libarchive/Kbuild.src b/archival/libarchive/Kbuild.src
index 968fdf8..fda05d8 100644
--- a/archival/libarchive/Kbuild.src
+++ b/archival/libarchive/Kbuild.src
@@ -33,6 +33,7 @@ DPKG_FILES:= \
 	get_header_ar.o \
 	get_header_tar.o \
 	get_header_tar_gz.o \
+	get_header_tar_xz.o \
 	get_header_tar_bz2.o \
 	get_header_tar_lzma.o \
 
diff --git a/archival/libarchive/filter_accept_list_reassign.c b/archival/libarchive/filter_accept_list_reassign.c
index 3d19abe..bcfeb96 100644
--- a/archival/libarchive/filter_accept_list_reassign.c
+++ b/archival/libarchive/filter_accept_list_reassign.c
@@ -28,12 +28,23 @@ char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle)
 		name_ptr++;
 
 		/* Modify the subarchive handler based on the extension */
+		if (strcmp(name_ptr, "tar") == 0
+		) {
+			archive_handle->dpkg__action_data_subarchive = get_header_tar;
+			return EXIT_SUCCESS;
+		}
 		if (ENABLE_FEATURE_SEAMLESS_GZ
 		 && strcmp(name_ptr, "gz") == 0
 		) {
 			archive_handle->dpkg__action_data_subarchive = get_header_tar_gz;
 			return EXIT_SUCCESS;
 		}
+		if (ENABLE_FEATURE_SEAMLESS_XZ
+		 && strcmp(name_ptr, "xz") == 0
+		) {
+			archive_handle->dpkg__action_data_subarchive = get_header_tar_xz;
+			return EXIT_SUCCESS;
+		}
 		if (ENABLE_FEATURE_SEAMLESS_BZ2
 		 && strcmp(name_ptr, "bz2") == 0
 		) {
diff --git a/archival/libarchive/get_header_tar_xz.c b/archival/libarchive/get_header_tar_xz.c
new file mode 100644
index 0000000..30ac522
--- /dev/null
+++ b/archival/libarchive/get_header_tar_xz.c
@@ -0,0 +1,21 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+
+#include "libbb.h"
+#include "bb_archive.h"
+
+char FAST_FUNC get_header_tar_xz(archive_handle_t *archive_handle)
+{
+	/* Can't lseek over pipes */
+	archive_handle->seek = seek_by_read;
+
+	open_transformer_with_sig(archive_handle->src_fd, unpack_xz_stream, "unxz");
+	archive_handle->offset = 0;
+	while (get_header_tar(archive_handle) == EXIT_SUCCESS)
+		continue;
+
+	/* Can only do one file at a time */
+	return EXIT_FAILURE;
+}
diff --git a/include/bb_archive.h b/include/bb_archive.h
index b82cfd8..a356f70 100644
--- a/include/bb_archive.h
+++ b/include/bb_archive.h
@@ -182,6 +182,7 @@ char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC;
 char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC;
 char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC;
 char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC;
+char get_header_tar_xz(archive_handle_t *archive_handle) FAST_FUNC;
 char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC;
 char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC;
 
-- 
1.7.10.4