1 |
commit: a00cf04f5b8d1c2b284c21cf3670b0d1a1a9ac51 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 14 10:20:56 2015 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 14 10:20:56 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a00cf04f |
7 |
|
8 |
app-arch/pbzip2: Revbump to fix possible data corruption (#567952). |
9 |
|
10 |
Package-Manager: portage-2.2.26 |
11 |
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> |
12 |
|
13 |
.../files/pbzip2-1.1.12-data_truncation_fix.patch | 142 +++++++++++++++++++++ |
14 |
app-arch/pbzip2/pbzip2-1.1.12-r1.ebuild | 44 +++++++ |
15 |
2 files changed, 186 insertions(+) |
16 |
|
17 |
diff --git a/app-arch/pbzip2/files/pbzip2-1.1.12-data_truncation_fix.patch b/app-arch/pbzip2/files/pbzip2-1.1.12-data_truncation_fix.patch |
18 |
new file mode 100644 |
19 |
index 0000000..0ce62e7 |
20 |
--- /dev/null |
21 |
+++ b/app-arch/pbzip2/files/pbzip2-1.1.12-data_truncation_fix.patch |
22 |
@@ -0,0 +1,142 @@ |
23 |
+https://bugs.launchpad.net/pbzip2/+bug/1524909 |
24 |
+https://bugs.gentoo.org/567952 |
25 |
+ |
26 |
+ |
27 |
+=== modified file 'pbzip2.cpp' |
28 |
+--- pbzip2.cpp 2014-12-21 10:20:27 +0000 |
29 |
++++ pbzip2.cpp 2015-12-11 00:14:31 +0000 |
30 |
+@@ -2083,6 +2083,17 @@ |
31 |
+ return 0; |
32 |
+ } |
33 |
+ |
34 |
++void close_streams(FILE *stream, FILE *zStream) |
35 |
++{ |
36 |
++ if (stream != NULL) |
37 |
++ fflush(stream); |
38 |
++ |
39 |
++ if (zStream != NULL && zStream != stdin) |
40 |
++ fclose(zStream); |
41 |
++ if (stream != NULL && stream != stdout) |
42 |
++ fclose(stream); |
43 |
++} |
44 |
++ |
45 |
+ /* |
46 |
+ ********************************************************* |
47 |
+ */ |
48 |
+@@ -2125,9 +2136,7 @@ |
49 |
+ // check file stream for errors |
50 |
+ if (ferror(zStream)) |
51 |
+ { |
52 |
+- if (zStream != stdin) |
53 |
+- fclose(zStream); |
54 |
+- |
55 |
++ close_streams(stream, zStream); |
56 |
+ handle_error(EF_EXIT, -1, |
57 |
+ "pbzip2: *ERROR: Problem with input stream of file [%s]! Aborting...\n", InFilename); |
58 |
+ return -1; |
59 |
+@@ -2155,9 +2164,7 @@ |
60 |
+ // check file stream for errors |
61 |
+ if (ferror(stream)) |
62 |
+ { |
63 |
+- if (stream != stdout) |
64 |
+- fclose(stream); |
65 |
+- |
66 |
++ close_streams(stream, zStream); |
67 |
+ handle_error(EF_EXIT, -1, |
68 |
+ "pbzip2: *ERROR: Problem with output stream of file [%s]! Aborting...\n", InFilename); |
69 |
+ return -1; |
70 |
+@@ -2169,10 +2176,7 @@ |
71 |
+ if (syncGetTerminateFlag() != 0) |
72 |
+ { |
73 |
+ fprintf (stderr, "directdecompress: terminating1 - terminateFlag set\n"); |
74 |
+- if (zStream != stdin) |
75 |
+- fclose(zStream); |
76 |
+- if (stream != stdout) |
77 |
+- fclose(stream); |
78 |
++ close_streams(stream, zStream); |
79 |
+ return -1; |
80 |
+ } |
81 |
+ |
82 |
+@@ -2180,11 +2184,8 @@ |
83 |
+ if (bzf == NULL || bzerr != BZ_OK) |
84 |
+ { |
85 |
+ ret = testBZ2ErrorHandling(bzerr, bzf, streamNo); |
86 |
+- if (zStream != stdin) |
87 |
+- fclose(zStream); |
88 |
+- if (stream != stdout) |
89 |
+- fclose(stream); |
90 |
+- |
91 |
++ close_streams(stream, zStream); |
92 |
++ |
93 |
+ if (ret != 0) |
94 |
+ { |
95 |
+ syncSetTerminateFlag(1); |
96 |
+@@ -2200,10 +2201,7 @@ |
97 |
+ if (syncGetTerminateFlag() != 0) |
98 |
+ { |
99 |
+ fprintf (stderr, "directdecompress: terminating2 - terminateFlag set\n"); |
100 |
+- if (zStream != stdin) |
101 |
+- fclose(zStream); |
102 |
+- if (stream != stdout) |
103 |
+- fclose(stream); |
104 |
++ close_streams(stream, zStream); |
105 |
+ return -1; |
106 |
+ } |
107 |
+ |
108 |
+@@ -2225,11 +2223,8 @@ |
109 |
+ if (ferror(zStream)) |
110 |
+ { |
111 |
+ ret = testBZ2ErrorHandling(bzerr, bzf, streamNo); |
112 |
+- if (zStream != stdin) |
113 |
+- fclose(zStream); |
114 |
+- if (stream != stdout) |
115 |
+- fclose(stream); |
116 |
+- |
117 |
++ close_streams(stream, zStream); |
118 |
++ |
119 |
+ if (ret != 0) |
120 |
+ { |
121 |
+ syncSetTerminateFlag(1); |
122 |
+@@ -2242,11 +2237,8 @@ |
123 |
+ if (ferror(stream)) |
124 |
+ { |
125 |
+ ret = testBZ2ErrorHandling(bzerr, bzf, streamNo); |
126 |
+- if (zStream != stdin) |
127 |
+- fclose(zStream); |
128 |
+- if (stream != stdout) |
129 |
+- fclose(stream); |
130 |
+- |
131 |
++ close_streams(stream, zStream); |
132 |
++ |
133 |
+ if (ret != 0) |
134 |
+ { |
135 |
+ syncSetTerminateFlag(1); |
136 |
+@@ -2263,11 +2255,8 @@ |
137 |
+ if (ferror(stream)) |
138 |
+ { |
139 |
+ ret = testBZ2ErrorHandling(bzerr, bzf, streamNo); |
140 |
+- if (zStream != stdin) |
141 |
+- fclose(zStream); |
142 |
+- if (stream != stdout) |
143 |
+- fclose(stream); |
144 |
+- |
145 |
++ close_streams(stream, zStream); |
146 |
++ |
147 |
+ if (ret != 0) |
148 |
+ { |
149 |
+ syncSetTerminateFlag(1); |
150 |
+@@ -2278,11 +2267,8 @@ |
151 |
+ if (bzerr != BZ_STREAM_END) |
152 |
+ { |
153 |
+ ret = testBZ2ErrorHandling(bzerr, bzf, streamNo); |
154 |
+- if (zStream != stdin) |
155 |
+- fclose(zStream); |
156 |
+- if (stream != stdout) |
157 |
+- fclose(stream); |
158 |
+- |
159 |
++ close_streams(stream, zStream); |
160 |
++ |
161 |
+ if (ret != 0) |
162 |
+ { |
163 |
+ syncSetTerminateFlag(1); |
164 |
+ |
165 |
|
166 |
diff --git a/app-arch/pbzip2/pbzip2-1.1.12-r1.ebuild b/app-arch/pbzip2/pbzip2-1.1.12-r1.ebuild |
167 |
new file mode 100644 |
168 |
index 0000000..a878d8d |
169 |
--- /dev/null |
170 |
+++ b/app-arch/pbzip2/pbzip2-1.1.12-r1.ebuild |
171 |
@@ -0,0 +1,44 @@ |
172 |
+# Copyright 1999-2015 Gentoo Foundation |
173 |
+# Distributed under the terms of the GNU General Public License v2 |
174 |
+# $Id$ |
175 |
+ |
176 |
+EAPI=5 |
177 |
+ |
178 |
+inherit flag-o-matic eutils |
179 |
+ |
180 |
+DESCRIPTION="Parallel bzip2 (de)compressor using libbz2" |
181 |
+HOMEPAGE="http://compression.ca/pbzip2/ https://launchpad.net/pbzip2" |
182 |
+SRC_URI="https://launchpad.net/pbzip2/${PV:0:3}/${PV}/+download/${P}.tar.gz" |
183 |
+ |
184 |
+LICENSE="BZIP2" |
185 |
+SLOT="0" |
186 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" |
187 |
+IUSE="static symlink" |
188 |
+ |
189 |
+LIB_DEPEND="app-arch/bzip2[static-libs(+)]" |
190 |
+RDEPEND=" |
191 |
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} ) |
192 |
+ symlink? ( !app-arch/lbzip2[symlink] )" |
193 |
+DEPEND="${RDEPEND} |
194 |
+ static? ( ${LIB_DEPEND} )" |
195 |
+ |
196 |
+src_prepare() { |
197 |
+ epatch "${FILESDIR}"/${PN}-1.1.10-makefile.patch \ |
198 |
+ "${FILESDIR}"/${P}-data_truncation_fix.patch |
199 |
+ tc-export CXX |
200 |
+ use static && append-ldflags -static |
201 |
+} |
202 |
+ |
203 |
+src_install() { |
204 |
+ dobin pbzip2 |
205 |
+ dodoc AUTHORS ChangeLog README |
206 |
+ doman pbzip2.1 |
207 |
+ dosym pbzip2 /usr/bin/pbunzip2 |
208 |
+ |
209 |
+ if use symlink ; then |
210 |
+ local s |
211 |
+ for s in bzip2 bunzip2 bzcat ; do |
212 |
+ dosym pbzip2 /usr/bin/${s} |
213 |
+ done |
214 |
+ fi |
215 |
+} |