backport upstream commit to fix appstream-index hang (#1098306)

This commit is contained in:
Rex Dieter 2014-06-28 16:03:51 -05:00
parent e75b1ac497
commit 92f797cd41
2 changed files with 55 additions and 4 deletions

View File

@ -0,0 +1,47 @@
From 5cadebe553d6bfdf0e9dde555ed084f4bb735f09 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Sat, 28 Jun 2014 22:20:48 +0200
Subject: [PATCH 55/55] Fix issue when loading compressed metadata files
Prevents an infinite loop which happens for some compressed files.
---
src/data-providers/appstream-xml.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/data-providers/appstream-xml.c b/src/data-providers/appstream-xml.c
index e9f2d2c..b1b512d 100644
--- a/src/data-providers/appstream-xml.c
+++ b/src/data-providers/appstream-xml.c
@@ -129,7 +129,7 @@ as_provider_appstream_xml_process_compressed_file (AsProviderAppstreamXML* self,
{
GFileInputStream* src_stream;
GMemoryOutputStream* mem_os;
- GConverterOutputStream* conv_stream;
+ GInputStream *conv_stream;
GZlibDecompressor* zdecomp;
guint8* data;
gboolean ret;
@@ -140,10 +140,10 @@ as_provider_appstream_xml_process_compressed_file (AsProviderAppstreamXML* self,
src_stream = g_file_read (infile, NULL, NULL);
mem_os = (GMemoryOutputStream*) g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
zdecomp = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
- conv_stream = (GConverterOutputStream*) g_converter_output_stream_new ((GOutputStream*) mem_os, (GConverter*) zdecomp);
+ conv_stream = g_converter_input_stream_new (G_INPUT_STREAM (src_stream), G_CONVERTER (zdecomp));
g_object_unref (zdecomp);
- g_output_stream_splice ((GOutputStream*) conv_stream, (GInputStream*) src_stream, 0, NULL, NULL);
+ g_output_stream_splice ((GOutputStream*) mem_os, conv_stream, 0, NULL, NULL);
data = g_memory_output_stream_get_data (mem_os);
ret = as_provider_appstream_xml_process_single_document (self, (const gchar*) data);
@@ -153,7 +153,6 @@ as_provider_appstream_xml_process_compressed_file (AsProviderAppstreamXML* self,
return ret;
}
-
gboolean
as_provider_appstream_xml_process_file (AsProviderAppstreamXML* self, GFile* infile)
{
--
1.9.3

View File

@ -2,7 +2,7 @@
Summary: Utilities to generate, maintain and access the AppStream Xapian database
Name: appstream
Version: 0.6.2
Release: 4%{?dist}
Release: 5%{?dist}
# lib LGPLv3+, tools GPLv3+
License: GPLv3+ and LGPLv3+
@ -10,6 +10,7 @@ URL: http://www.freedesktop.org/wiki/Distributions/AppStream/Software
Source0: http://www.freedesktop.org/software/appstream/releases/AppStream-%{version}.tar.gz
## upstream patches
Patch55: 0055-Fix-issue-when-loading-compressed-metadata-files.patch
## upstreamable patches
@ -45,7 +46,7 @@ Requires: vala
%prep
%setup -q -n AppStream-%{version}
%autosetup -n AppStream-%{version} -p1
%build
@ -68,14 +69,14 @@ touch %{buildroot}/var/cache/app-info/cache.watch
%check
# 1/3 tests currently fail, make non-fatal for now
# all/many tests currently fail, make non-fatal for now
make test -C %{_target_platform} ARGS="--output-on-failure --timeout 300" ||:
## include this scriptlet *somewhere*, but only if it is safe and
## won't hang or take a long time, see
## https://bugzilla.redhat.com/1098306
#{_bindir}/appstream-index --refresh --force >& /dev/null ||:
%{_bindir}/appstream-index --refresh --force >& /dev/null ||:
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
@ -115,6 +116,9 @@ make test -C %{_target_platform} ARGS="--output-on-failure --timeout 300" ||:
%changelog
* Sat Jun 28 2014 Rex Dieter <rdieter@fedoraproject.org> 0.6.2-5
- backport upstream commit to fix appstream-index hang (#1098306)
* Fri Jun 20 2014 Rex Dieter <rdieter@fedoraproject.org> 0.6.2-4
- appstream-index scriptlet hanging, skip for now (#1098306)