Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/libarchive/, app-arch/libarchive/files/
Date: Mon, 02 Sep 2019 07:07:45
Message-Id: 1567408041.2724e477dbeef81ed5f8ad995e738c776379485c.polynomial-c@gentoo
1 commit: 2724e477dbeef81ed5f8ad995e738c776379485c
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 2 07:07:21 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 2 07:07:21 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2724e477
7
8 app-arch/libarchive: Fixed build with USE="-zlib"
9
10 Thanks-to: Albert W. Hopkins <marduk <AT> letterboxes.org>
11 Thanks-to: Stephan Hartmann <stha09 <AT> googlemail.com>
12 Closes: https://bugs.gentoo.org/693202
13 Package-Manager: Portage-2.3.75, Repoman-2.3.17
14 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
15
16 .../libarchive-3.4.0-without_zlib_build_fix.patch | 160 +++++++++++++++++++++
17 app-arch/libarchive/libarchive-3.4.0.ebuild | 1 +
18 2 files changed, 161 insertions(+)
19
20 diff --git a/app-arch/libarchive/files/libarchive-3.4.0-without_zlib_build_fix.patch b/app-arch/libarchive/files/libarchive-3.4.0-without_zlib_build_fix.patch
21 new file mode 100644
22 index 00000000000..e0a3167390f
23 --- /dev/null
24 +++ b/app-arch/libarchive/files/libarchive-3.4.0-without_zlib_build_fix.patch
25 @@ -0,0 +1,160 @@
26 +From 64333cef68d7bcc67bef6ecf177fbeaa549b9139 Mon Sep 17 00:00:00 2001
27 +From: Martin Matuska <martin@×××××××.org>
28 +Date: Sat, 29 Jun 2019 00:20:58 +0200
29 +Subject: [PATCH] Unbreak compilation without zlib
30 +
31 +Fixes #1214
32 +---
33 + libarchive/archive_read_support_filter_gzip.c | 54 ++++++++++++-------
34 + libarchive/test/test_read_format_raw.c | 4 ++
35 + 2 files changed, 39 insertions(+), 19 deletions(-)
36 +
37 +diff --git a/libarchive/archive_read_support_filter_gzip.c b/libarchive/archive_read_support_filter_gzip.c
38 +index 458b6f729..9fa9e2b0d 100644
39 +--- a/libarchive/archive_read_support_filter_gzip.c
40 ++++ b/libarchive/archive_read_support_filter_gzip.c
41 +@@ -131,12 +131,20 @@ archive_read_support_filter_gzip(struct archive *_a)
42 + */
43 + static ssize_t
44 + peek_at_header(struct archive_read_filter *filter, int *pbits,
45 +- struct private_data *state)
46 ++#ifdef HAVE_ZLIB_H
47 ++ struct private_data *state
48 ++#else
49 ++ void *state
50 ++#endif
51 ++ )
52 + {
53 + const unsigned char *p;
54 + ssize_t avail, len;
55 + int bits = 0;
56 + int header_flags;
57 ++#ifndef HAVE_ZLIB_H
58 ++ (void)state; /* UNUSED */
59 ++#endif
60 +
61 + /* Start by looking at the first ten bytes of the header, which
62 + * is all fixed layout. */
63 +@@ -153,8 +161,10 @@ peek_at_header(struct archive_read_filter *filter, int *pbits,
64 + bits += 3;
65 + header_flags = p[3];
66 + /* Bytes 4-7 are mod time in little endian. */
67 ++#ifdef HAVE_ZLIB_H
68 + if (state)
69 + state->mtime = archive_le32dec(p + 4);
70 ++#endif
71 + /* Byte 8 is deflate flags. */
72 + /* XXXX TODO: return deflate flags back to consume_header for use
73 + in initializing the decompressor. */
74 +@@ -171,7 +181,9 @@ peek_at_header(struct archive_read_filter *filter, int *pbits,
75 +
76 + /* Null-terminated optional filename. */
77 + if (header_flags & 8) {
78 ++#ifdef HAVE_ZLIB_H
79 + ssize_t file_start = len;
80 ++#endif
81 + do {
82 + ++len;
83 + if (avail < len)
84 +@@ -181,11 +193,13 @@ peek_at_header(struct archive_read_filter *filter, int *pbits,
85 + return (0);
86 + } while (p[len - 1] != 0);
87 +
88 ++#ifdef HAVE_ZLIB_H
89 + if (state) {
90 + /* Reset the name in case of repeat header reads. */
91 + free(state->name);
92 + state->name = strdup((const char *)&p[file_start]);
93 + }
94 ++#endif
95 + }
96 +
97 + /* Null-terminated optional comment. */
98 +@@ -236,24 +250,6 @@ gzip_bidder_bid(struct archive_read_filter_bidder *self,
99 + return (0);
100 + }
101 +
102 +-static int
103 +-gzip_read_header(struct archive_read_filter *self, struct archive_entry *entry)
104 +-{
105 +- struct private_data *state;
106 +-
107 +- state = (struct private_data *)self->data;
108 +-
109 +- /* A mtime of 0 is considered invalid/missing. */
110 +- if (state->mtime != 0)
111 +- archive_entry_set_mtime(entry, state->mtime, 0);
112 +-
113 +- /* If the name is available, extract it. */
114 +- if (state->name)
115 +- archive_entry_set_pathname(entry, state->name);
116 +-
117 +- return (ARCHIVE_OK);
118 +-}
119 +-
120 + #ifndef HAVE_ZLIB_H
121 +
122 + /*
123 +@@ -277,6 +273,24 @@ gzip_bidder_init(struct archive_read_filter *self)
124 +
125 + #else
126 +
127 ++static int
128 ++gzip_read_header(struct archive_read_filter *self, struct archive_entry *entry)
129 ++{
130 ++ struct private_data *state;
131 ++
132 ++ state = (struct private_data *)self->data;
133 ++
134 ++ /* A mtime of 0 is considered invalid/missing. */
135 ++ if (state->mtime != 0)
136 ++ archive_entry_set_mtime(entry, state->mtime, 0);
137 ++
138 ++ /* If the name is available, extract it. */
139 ++ if (state->name)
140 ++ archive_entry_set_pathname(entry, state->name);
141 ++
142 ++ return (ARCHIVE_OK);
143 ++}
144 ++
145 + /*
146 + * Initialize the filter object.
147 + */
148 +@@ -306,7 +320,9 @@ gzip_bidder_init(struct archive_read_filter *self)
149 + self->read = gzip_filter_read;
150 + self->skip = NULL; /* not supported */
151 + self->close = gzip_filter_close;
152 ++#ifdef HAVE_ZLIB_H
153 + self->read_header = gzip_read_header;
154 ++#endif
155 +
156 + state->in_stream = 0; /* We're not actually within a stream yet. */
157 +
158 +diff --git a/libarchive/test/test_read_format_raw.c b/libarchive/test/test_read_format_raw.c
159 +index 0dac8bfba..3961723b4 100644
160 +--- a/libarchive/test/test_read_format_raw.c
161 ++++ b/libarchive/test/test_read_format_raw.c
162 +@@ -36,7 +36,9 @@ DEFINE_TEST(test_read_format_raw)
163 + const char *reffile1 = "test_read_format_raw.data";
164 + const char *reffile2 = "test_read_format_raw.data.Z";
165 + const char *reffile3 = "test_read_format_raw.bufr";
166 ++#ifdef HAVE_ZLIB_H
167 + const char *reffile4 = "test_read_format_raw.data.gz";
168 ++#endif
169 +
170 + /* First, try pulling data out of an uninterpretable file. */
171 + extract_reference_file(reffile1);
172 +@@ -119,6 +121,7 @@ DEFINE_TEST(test_read_format_raw)
173 + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
174 + assertEqualInt(ARCHIVE_OK, archive_read_free(a));
175 +
176 ++#ifdef HAVE_ZLIB_H
177 + /* Fourth, try with gzip which has metadata. */
178 + extract_reference_file(reffile4);
179 + assert((a = archive_read_new()) != NULL);
180 +@@ -144,4 +147,5 @@ DEFINE_TEST(test_read_format_raw)
181 + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
182 + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
183 + assertEqualInt(ARCHIVE_OK, archive_read_free(a));
184 ++#endif
185 + }
186
187 diff --git a/app-arch/libarchive/libarchive-3.4.0.ebuild b/app-arch/libarchive/libarchive-3.4.0.ebuild
188 index 6780bc9cabe..47f77c61efd 100644
189 --- a/app-arch/libarchive/libarchive-3.4.0.ebuild
190 +++ b/app-arch/libarchive/libarchive-3.4.0.ebuild
191 @@ -38,6 +38,7 @@ DEPEND="${RDEPEND}
192
193 PATCHES=(
194 "${FILESDIR}"/${PN}-3.3.3-libressl.patch
195 + "${FILESDIR}"/${P}-without_zlib_build_fix.patch #693202
196 )
197
198 # Various test problems, starting with the fact that sandbox