Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/easytag/files/, media-sound/easytag/
Date: Sun, 02 Dec 2018 18:44:00
Message-Id: 1543776215.645351f868ac449b80ad507dd46ad0ccb1c3874e.asturm@gentoo
1 commit: 645351f868ac449b80ad507dd46ad0ccb1c3874e
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 2 17:41:23 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 2 18:43:35 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=645351f8
7
8 media-sound/easytag: Fix ogg corruption
9
10 Non-maintainer commit. (Revert) Patch taken from openSUSE.
11
12 See also: https://bugzilla.gnome.org/show_bug.cgi?id=776110
13 Reported-by: Florian Berger <florian.berger <AT> posteo.de>
14 Thanks-to: Patrice Levesque <gentoo.wayne <AT> ptaff.ca>
15 Closes: https://bugs.gentoo.org/617818
16 Package-Manager: Portage-2.3.52, Repoman-2.3.12
17 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
18
19 media-sound/easytag/easytag-2.4.3-r1.ebuild | 72 ++++++
20 .../files/easytag-2.4.3-ogg-corruption.patch | 246 +++++++++++++++++++++
21 2 files changed, 318 insertions(+)
22
23 diff --git a/media-sound/easytag/easytag-2.4.3-r1.ebuild b/media-sound/easytag/easytag-2.4.3-r1.ebuild
24 new file mode 100644
25 index 00000000000..30e559c81cd
26 --- /dev/null
27 +++ b/media-sound/easytag/easytag-2.4.3-r1.ebuild
28 @@ -0,0 +1,72 @@
29 +# Copyright 1999-2018 Gentoo Authors
30 +# Distributed under the terms of the GNU General Public License v2
31 +
32 +EAPI=6
33 +
34 +GNOME2_LA_PUNT="yes"
35 +inherit gnome2
36 +
37 +DESCRIPTION="GTK+ utility for editing MP2, MP3, MP4, FLAC, Ogg and other media tags"
38 +HOMEPAGE="https://wiki.gnome.org/Apps/EasyTAG"
39 +
40 +LICENSE="GPL-2 GPL-2+ LGPL-2 LGPL-2+ LGPL-2.1+"
41 +SLOT="0"
42 +KEYWORDS="alpha amd64 ~arm hppa ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris"
43 +
44 +IUSE="flac mp3 mp4 opus speex test vorbis wavpack"
45 +REQUIRED_USE="
46 + opus? ( vorbis )
47 + speex? ( vorbis )
48 +"
49 +
50 +RDEPEND="
51 + >=dev-libs/glib-2.38:2
52 + media-libs/libcanberra[gtk3]
53 + >=x11-libs/gtk+-3.10:3
54 + flac? ( >=media-libs/flac-1.3 )
55 + mp3? (
56 + >=media-libs/id3lib-3.8.3-r8
57 + >=media-libs/libid3tag-0.15.1b-r4
58 + )
59 + mp4? ( >=media-libs/taglib-1.9.1[mp4(+)] )
60 + opus? (
61 + >=media-libs/opus-1.1
62 + >=media-libs/opusfile-0.4
63 + )
64 + speex? ( >=media-libs/speex-1.2_rc1 )
65 + vorbis? (
66 + >=media-libs/libogg-1.3.1
67 + >=media-libs/libvorbis-1.3.4
68 + )
69 + wavpack? ( >=media-sound/wavpack-4.70 )
70 +"
71 +DEPEND="${RDEPEND}
72 + app-text/docbook-xml-dtd:4.4
73 + app-text/yelp-tools
74 + dev-libs/libxml2
75 + dev-libs/libxslt
76 + >=dev-util/intltool-0.50
77 + >=sys-devel/gettext-0.18.3.2
78 + virtual/pkgconfig
79 + test? (
80 + dev-libs/appstream-glib
81 + >=dev-util/desktop-file-utils-0.22
82 + )
83 +"
84 +
85 +PATCHES=( "${FILESDIR}/${P}-ogg-corruption.patch" )
86 +
87 +src_configure() {
88 + gnome2_src_configure \
89 + --disable-Werror \
90 + $(use_enable test appdata-validate) \
91 + $(use_enable test tests) \
92 + $(use_enable mp3) \
93 + $(use_enable mp3 id3v23) \
94 + $(use_enable vorbis ogg) \
95 + $(use_enable opus) \
96 + $(use_enable speex) \
97 + $(use_enable flac) \
98 + $(use_enable mp4) \
99 + $(use_enable wavpack)
100 +}
101
102 diff --git a/media-sound/easytag/files/easytag-2.4.3-ogg-corruption.patch b/media-sound/easytag/files/easytag-2.4.3-ogg-corruption.patch
103 new file mode 100644
104 index 00000000000..7c4a9f619c3
105 --- /dev/null
106 +++ b/media-sound/easytag/files/easytag-2.4.3-ogg-corruption.patch
107 @@ -0,0 +1,246 @@
108 +From e5c640ca3f259f1b74e716723345521987a7bd68 Mon Sep 17 00:00:00 2001
109 +From: David King <amigadave@×××××××××.com>
110 +Date: Wed, 9 Nov 2016 17:29:34 +0000
111 +Subject: Do not maintain an open handle on Ogg files
112 +
113 +Only keep a file open for reading long enough to read the necessary
114 +items from the file. Remove the file input stream from EtOggState, as
115 +it is no longer preserved across function calls.
116 +
117 + src/tags/vcedit.c | 92 ++++++++++++++++++++++---------------------------------
118 + 1 file changed, 36 insertions(+), 56 deletions(-)
119 +
120 +--- b/src/tags/vcedit.c
121 ++++ a/src/tags/vcedit.c
122 +@@ -35,6 +35,7 @@
123 + struct _EtOggState
124 + {
125 + /*< private >*/
126 ++ GFileInputStream *in;
127 + #ifdef ENABLE_SPEEX
128 + SpeexHeader *si;
129 + #endif
130 +@@ -125,6 +126,11 @@
131 + }
132 + #endif /* ENABLE_OPUS */
133 +
134 ++ if (state->in)
135 ++ {
136 ++ g_object_unref (state->in);
137 ++ }
138 ++
139 + memset (state, 0, sizeof (*state));
140 + }
141 +
142 +@@ -239,7 +245,6 @@
143 +
144 + static gboolean
145 + _fetch_next_packet (EtOggState *s,
146 +- GInputStream *istream,
147 + ogg_packet *p,
148 + ogg_page *page,
149 + GError **error)
150 +@@ -269,8 +274,8 @@
151 + while (ogg_sync_pageout (s->oy, page) <= 0)
152 + {
153 + buffer = ogg_sync_buffer (s->oy, CHUNKSIZE);
154 ++ bytes = g_input_stream_read (G_INPUT_STREAM (s->in), buffer,
155 ++ CHUNKSIZE, NULL, error);
156 +- bytes = g_input_stream_read (istream, buffer, CHUNKSIZE, NULL,
157 +- error);
158 + ogg_sync_wrote (s->oy, bytes);
159 +
160 + if(bytes == 0)
161 +@@ -303,7 +308,7 @@
162 +
163 + g_assert (error == NULL || *error == NULL);
164 + ogg_stream_pagein (s->os, page);
165 ++ return _fetch_next_packet (s, p, page, error);
166 +- return _fetch_next_packet (s, istream, p, page, error);
167 + }
168 + }
169 +
170 +@@ -402,13 +407,14 @@
171 + return FALSE;
172 + }
173 +
174 ++ state->in = istream;
175 + state->oy = g_slice_new (ogg_sync_state);
176 + ogg_sync_init (state->oy);
177 +
178 + while(1)
179 + {
180 + buffer = ogg_sync_buffer (state->oy, CHUNKSIZE);
181 ++ bytes = g_input_stream_read (G_INPUT_STREAM (state->in), buffer,
182 +- bytes = g_input_stream_read (G_INPUT_STREAM (istream), buffer,
183 + CHUNKSIZE, NULL, error);
184 + if (bytes == -1)
185 + {
186 +@@ -648,7 +654,7 @@
187 + }
188 +
189 + buffer = ogg_sync_buffer (state->oy, CHUNKSIZE);
190 ++ bytes = g_input_stream_read (G_INPUT_STREAM (state->in), buffer,
191 +- bytes = g_input_stream_read (G_INPUT_STREAM (istream), buffer,
192 + CHUNKSIZE, NULL, error);
193 +
194 + if (bytes == -1)
195 +@@ -670,14 +676,11 @@
196 +
197 + /* Headers are done! */
198 + g_assert (error == NULL || *error == NULL);
199 +- /* TODO: Handle error during stream close. */
200 +- g_object_unref (istream);
201 +
202 + return TRUE;
203 +
204 + err:
205 + g_assert (error == NULL || *error != NULL);
206 +- g_object_unref (istream);
207 + vcedit_clear_internals (state);
208 + return FALSE;
209 + }
210 +@@ -699,7 +702,6 @@
211 + char *buffer;
212 + int bytes;
213 + int needflush = 0, needout = 0;
214 +- GFileInputStream *istream;
215 + GOutputStream *ostream;
216 + gchar *buf;
217 + gsize size;
218 +@@ -707,22 +709,11 @@
219 +
220 + g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
221 +
222 ++ fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE,
223 ++ G_FILE_QUERY_INFO_NONE, NULL, error);
224 +- istream = g_file_read (file, NULL, error);
225 +-
226 +- if (!istream)
227 +- {
228 +- g_assert (error == NULL || *error != NULL);
229 +- return FALSE;
230 +- }
231 +-
232 +- fileinfo = g_file_input_stream_query_info (istream,
233 +- G_FILE_ATTRIBUTE_STANDARD_SIZE,
234 +- NULL, error);
235 +-
236 + if (!fileinfo)
237 + {
238 + g_assert (error == NULL || *error != NULL);
239 +- g_object_unref (istream);
240 + return FALSE;
241 + }
242 +
243 +@@ -783,8 +774,7 @@
244 + }
245 + }
246 +
247 ++ while (_fetch_next_packet (state, &op, &ogin, error))
248 +- while (_fetch_next_packet (state, G_INPUT_STREAM (istream), &op, &ogin,
249 +- error))
250 + {
251 + if (needflush)
252 + {
253 +@@ -960,7 +950,7 @@
254 + {
255 + /* We copy the rest of the stream (other logical streams)
256 + * through, a page at a time. */
257 ++ while(1)
258 +- while (1)
259 + {
260 + result = ogg_sync_pageout (state->oy, &ogout);
261 +
262 +@@ -999,7 +989,7 @@
263 +
264 + buffer = ogg_sync_buffer (state->oy, CHUNKSIZE);
265 +
266 ++ bytes = g_input_stream_read (G_INPUT_STREAM (state->in), buffer,
267 +- bytes = g_input_stream_read (G_INPUT_STREAM (istream), buffer,
268 + CHUNKSIZE, NULL, error);
269 +
270 + if (bytes == -1)
271 +@@ -1017,19 +1007,11 @@
272 + }
273 + }
274 +
275 ++
276 + cleanup:
277 + ogg_stream_clear (&streamout);
278 + ogg_packet_clear (&header_comments);
279 +
280 +- if (!g_input_stream_close (G_INPUT_STREAM (istream), NULL, error))
281 +- {
282 +- /* Ignore the _close() failure, and try the write anyway. */
283 +- g_warning ("Error closing Ogg file for reading: %s",
284 +- (*error)->message);
285 +- g_clear_error (error);
286 +- }
287 +-
288 +- g_object_unref (istream);
289 + g_free (state->mainbuf);
290 + g_free (state->bookbuf);
291 + state->mainbuf = state->bookbuf = NULL;
292 +@@ -1063,13 +1045,41 @@
293 + buf = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (ostream));
294 + size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (ostream));
295 +
296 ++ /* At least on Windows, writing to a file with an open-for-reading stream
297 ++ * fails, so close the input stream before writing to the file. */
298 ++ if (!g_input_stream_close (G_INPUT_STREAM (state->in), NULL, error))
299 ++ {
300 ++ /* Ignore the _close() failure, and try the write anyway. */
301 ++ g_warning ("Error closing Ogg file for reading: %s",
302 ++ (*error)->message);
303 ++ g_clear_error (error);
304 ++ }
305 ++
306 ++ g_object_unref (state->in);
307 ++ state->in = NULL;
308 ++
309 + /* Write the in-memory data back out to the original file. */
310 + if (!g_file_replace_contents (file, buf, size, NULL, FALSE,
311 + G_FILE_CREATE_NONE, NULL, NULL, error))
312 + {
313 ++ GError *tmp_error = NULL;
314 ++
315 + g_object_unref (ostream);
316 + g_free (buf);
317 +
318 ++ /* Re-open the file for reading, to keep the internal state
319 ++ * consistent. */
320 ++ state->in = g_file_read (file, NULL, &tmp_error);
321 ++
322 ++ if (!state->in)
323 ++ {
324 ++ g_warning ("Error opening Ogg file for reading after write failure: %s",
325 ++ tmp_error->message);
326 ++ g_clear_error (&tmp_error);
327 ++ g_assert (error == NULL || *error != NULL);
328 ++ return FALSE;
329 ++ }
330 ++
331 + g_assert (error == NULL || *error != NULL);
332 + return FALSE;
333 + }
334 +@@ -1077,6 +1087,16 @@
335 + g_free (buf);
336 + g_object_unref (ostream);
337 +
338 ++ /* Re-open the file, now that the write has completed. */
339 ++ state->in = g_file_read (file, NULL, error);
340 ++
341 ++ if (!state->in)
342 ++ {
343 ++ g_assert (error == NULL || *error != NULL);
344 ++ return FALSE;
345 ++ }
346 ++
347 ++
348 + return TRUE;
349 + }
350 +
351 +--
352 +cgit v0.12
353 +