Accepting request 779429 from KDE:Frameworks5

OBS-URL: https://build.opensuse.org/request/show/779429
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/AppStream?expand=0&rev=17
This commit is contained in:
Dominique Leuenberger 2020-02-28 14:19:15 +00:00 committed by Git OBS Bridge
commit 461fa41e42
11 changed files with 35 additions and 343 deletions

View File

@ -1,29 +0,0 @@
From 9dbdb8257e95a1f657dc043028a354ac17091875 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Sat, 13 Jul 2019 16:03:47 +0200
Subject: [PATCH 1/3] Fix possible NULL dereference
An error check was missing here. Thanks Coverity for pointing this out!
---
src/as-cache.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/as-cache.c b/src/as-cache.c
index 41f78a8b..50b42193 100644
--- a/src/as-cache.c
+++ b/src/as-cache.c
@@ -1589,6 +1589,11 @@ as_cache_register_addons_for_component (AsCache *cache, MDB_txn *txn, AsComponen
return TRUE;
addons = as_cache_components_by_hash_list (cache, txn, dval.mv_data, dval.mv_size, &tmp_error);
+ if (addons == NULL) {
+ g_propagate_error (error, tmp_error);
+ return FALSE;
+ }
+
for (guint i = 0; i < addons->len; i++)
as_component_add_addon (cpt, AS_COMPONENT (g_ptr_array_index (addons, i)));
--
2.22.0

View File

@ -1,150 +0,0 @@
From 919bea53ada992d8f02b5e6e1e016c912ca9aadf Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Mon, 17 Jun 2019 20:51:21 +0200
Subject: [PATCH] Restore compatibility with GLib < 2.58
Since g_ptr_array_steal_index_fast() does not exist in older GLib
versions, we do something that is - sort of - equivalent when building
against older versions (but slightly slower and uglier).
---
src/as-cache.c | 3 +--
src/as-pool.c | 21 +++++++--------------
src/as-utils-private.h | 3 +++
src/as-utils.c | 25 +++++++++++++++++++++++++
4 files changed, 36 insertions(+), 16 deletions(-)
Index: AppStream-0.12.7/src/as-cache.c
===================================================================
--- AppStream-0.12.7.orig/src/as-cache.c
+++ AppStream-0.12.7/src/as-cache.c
@@ -1909,8 +1909,7 @@ as_cache_get_components_by_categories (A
return NULL;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
if (result == NULL) {
Index: AppStream-0.12.7/src/as-pool.c
===================================================================
--- AppStream-0.12.7.orig/src/as-pool.c
+++ AppStream-0.12.7/src/as-pool.c
@@ -1283,8 +1283,7 @@ as_pool_get_components (AsPool *pool)
g_warning ("Unable to retrieve all components from system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1321,8 +1320,7 @@ as_pool_get_components_by_id (AsPool *po
g_warning ("Unable find components by ID in system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1360,8 +1358,7 @@ as_pool_get_components_by_provided_item
g_warning ("Unable find components by provided item in system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1396,8 +1393,7 @@ as_pool_get_components_by_kind (AsPool *
g_warning ("Unable find components by kind in system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1439,8 +1435,7 @@ as_pool_get_components_by_categories (As
g_warning ("Unable find components by categories in system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1481,8 +1476,7 @@ as_pool_get_components_by_launchable (As
g_warning ("Unable find components by launchable in system cache: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
return result;
@@ -1629,8 +1623,7 @@ as_pool_search (AsPool *pool, const gcha
g_warning ("Search in system cache failed: %s", tmp_error->message);
return result;
}
- while (tmp_res->len != 0)
- g_ptr_array_add (result, g_ptr_array_steal_index_fast (tmp_res, 0));
+ as_object_ptr_array_absorb (result, tmp_res);
}
/* sort the results by their priority (this was explicitly disabled for the caches before,
Index: AppStream-0.12.7/src/as-utils-private.h
===================================================================
--- AppStream-0.12.7.orig/src/as-utils-private.h
+++ AppStream-0.12.7/src/as-utils-private.h
@@ -93,6 +93,9 @@ gchar *as_utils_dns_to_rdns (const gch
void as_utils_sort_components_by_score (GPtrArray *cpts);
+void as_object_ptr_array_absorb (GPtrArray *dest,
+ GPtrArray *src);
+
#pragma GCC visibility pop
G_END_DECLS
Index: AppStream-0.12.7/src/as-utils.c
===================================================================
--- AppStream-0.12.7.orig/src/as-utils.c
+++ AppStream-0.12.7/src/as-utils.c
@@ -1261,3 +1261,28 @@ as_utils_sort_components_by_score (GPtrA
{
g_ptr_array_sort (cpts, as_sort_components_by_score_cb);
}
+
+/**
+ * as_object_ptr_array_absorb:
+ *
+ * Append contents from source array of GObjects to destination array,
+ * transferring ownership to the destination and removing values
+ * from the source (effectively moving the data).
+ * The source array will be empty afterwards.
+ *
+ * This function assumes that a GDestroyNotify function is set on the
+ * GPtrArray if GLib < 2.58.
+ */
+void
+as_object_ptr_array_absorb (GPtrArray *dest, GPtrArray *src)
+{
+#if GLIB_CHECK_VERSION(2,58,0)
+ while (src->len != 0)
+ g_ptr_array_add (dest, g_ptr_array_steal_index_fast (src, 0));
+#else
+ while (src->len != 0) {
+ g_ptr_array_add (dest, g_object_ref (g_ptr_array_index (src, 0)));
+ g_ptr_array_remove_index_fast (src, 0);
+ }
+#endif
+}

View File

@ -1,44 +0,0 @@
From 993ea2bc6917327f3f4de421cd8f9594f550ff98 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Tue, 30 Jul 2019 02:14:53 +0200
Subject: [PATCH 2/3] Don't ignore xmlNodeDump return code
This should not fail, ever, unless we run out of memory. But since I was
looking at that code, having a sanity check here is better in case this
does become more relevant in future (and simply because not checking it
was not good prectice).
---
src/as-xml.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/as-xml.c b/src/as-xml.c
index 2ba64743..bfa90e72 100644
--- a/src/as-xml.c
+++ b/src/as-xml.c
@@ -94,13 +94,20 @@ as_xml_dump_node_children (xmlNode *node)
str = g_string_new ("");
for (iter = node->children; iter != NULL; iter = iter->next) {
+ gint r;
+
/* discard spaces */
if (iter->type != XML_ELEMENT_NODE) {
- continue;
+ continue;
}
- nodeBuf = xmlBufferCreate();
- xmlNodeDump (nodeBuf, NULL, iter, 0, 1);
+ nodeBuf = xmlBufferCreate ();
+ r = xmlNodeDump (nodeBuf, NULL, iter, 0, 1);
+ if (r < 0) {
+ xmlBufferFree (nodeBuf);
+ g_warning ("xmlNodeDump failed (%i) while serializing node children.", r);
+ continue;
+ }
if (str->len > 0)
g_string_append (str, "\n");
g_string_append_printf (str, "%s", (const gchar*) nodeBuf->content);
--
2.22.0

View File

@ -1,72 +0,0 @@
From 823d7065ffcaec57bdbef479dce49ae97ff08640 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Tue, 30 Jul 2019 02:38:47 +0200
Subject: [PATCH 3/3] Fix infinite recursion if component has itself listed as
an addon
This particular case of a component being an addon to itself is
nonsense, but people may make that mistake and we shouldn't crash in
that case.
With this patch the cache will be resilient against such cases and
simply ignore components depending on themselves.
We could still get nasty dependency loops though, with A depending on B
depending on A. This is a bit more complicated to resolve and will be
fixed in a future commit.
Resolves: #243
---
src/as-cache.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/as-cache.c b/src/as-cache.c
index 50b42193..3afabda7 100644
--- a/src/as-cache.c
+++ b/src/as-cache.c
@@ -1573,7 +1573,7 @@ as_cache_register_addons_for_component (AsCache *cache, MDB_txn *txn, AsComponen
{
AsCachePrivate *priv = GET_PRIVATE (cache);
MDB_val dval;
- g_autoptr(GPtrArray) addons = NULL;
+ g_autofree guint8 *cpt_checksum = NULL;
GError *tmp_error = NULL;
dval = as_cache_txn_get_value (cache,
@@ -1588,14 +1588,29 @@ as_cache_register_addons_for_component (AsCache *cache, MDB_txn *txn, AsComponen
if (dval.mv_size == 0)
return TRUE;
- addons = as_cache_components_by_hash_list (cache, txn, dval.mv_data, dval.mv_size, &tmp_error);
- if (addons == NULL) {
- g_propagate_error (error, tmp_error);
- return FALSE;
- }
+ /* retrieve cache checksum of this component */
+ as_generate_cache_checksum (as_component_get_data_id (cpt),
+ -1,
+ &cpt_checksum,
+ NULL);
+
+ g_assert_cmpint (dval.mv_size % AS_CACHE_CHECKSUM_LEN, ==, 0);
+ for (gsize i = 0; i < dval.mv_size; i += AS_CACHE_CHECKSUM_LEN) {
+ const guint8 *chash = dval.mv_data + i;
+ AsComponent *addon;
+
+ /* ignore addon that extends itself to prevent infinite recursion */
+ if (memcmp (chash, cpt_checksum, AS_CACHE_CHECKSUM_LEN) == 0)
+ continue;
- for (guint i = 0; i < addons->len; i++)
- as_component_add_addon (cpt, AS_COMPONENT (g_ptr_array_index (addons, i)));
+ addon = as_cache_component_by_hash (cache, txn, chash, &tmp_error);
+ if (tmp_error != NULL) {
+ g_propagate_prefixed_error (error, tmp_error, "Failed to retrieve addon component data: ");
+ return FALSE;
+ }
+ if (addon != NULL)
+ as_component_add_addon (cpt, addon);
+ }
return TRUE;
}
--
2.22.0

3
AppStream-0.12.10.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f0a2c550729e4ccd29844c7a9d021f687fb133ffb37f23f928d50a125d7bd0f
size 2045744

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE0zo/DKFrCsxRpgc4SUyKX79N7OsFAl4jSrMACgkQSUyKX79N
7OumjhAAn1U7ksQKVk1pmUSnYaE+G3baDM5A7Zocd2C9bjwyqNOFMCawWLBez+MU
wX0eBijrO5uCsBw0wzSWwLdRA80E62HHLyoTClgCCXVQJ7lIcZFtKNTCSK3kYVsc
OH3x6WMS8uZly1AqunJmLl8UgF3dytLDjhNTSOZf0Kgt/2kYTV1XDo+h/z2JUCiG
gatrpdJ7P47MAUEl4iIrRCQa8fbuBXTKQ2608GvMSE52quS1PWiCHnX3oqc199Bc
6lF3p9opzSw5fsaIY+FeQdXDSJBLpa+r/HizoopO3oPRCBeBOENpTtk7QFM68Pnw
DqtaONR1gvgSj7fekb/GndW5DPiFCyG6NDvuGbYgX/Og4AXtcPBgAgbhFztiUMoj
oq49twAqgtsTA2ED5A+HJo1OVwgbyKsaterYG8Nb15M//5VmCFSqKjseejQZidt4
XtnvcWAVTIUVoaJTM5Kb9sLvqXt+DAPH+83Lo86XDqj7UeK5ZbQmyL/YZ2Cbz7SQ
xwB1fJn4zoTKSNrya4Y80aWaeDC1c2lzDGLWQX7rcLZbwrzIDFea4AJQf1I7MMOT
u7BarmqJLDmIR/IoPXRskN9JET+Duh1vy+IRinJqP7qIGIaDBOKnLFIquRUj31nB
mT+mSlmtDYZ31d5udlDa79urv3YsDoyg6MYm13OfY1SU9S7gdrU=
=fY1b
-----END PGP SIGNATURE-----

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:696d2f09187a8cdcb1e87a881a9634b5d921f8d24be08e4f41f2bcf11d8b57d5
size 1958948

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE0zo/DKFrCsxRpgc4SUyKX79N7OsFAl0Gp4MACgkQSUyKX79N
7OsCxg//aqKkpkUdIx51Tei12DtBi7m6sV86B8JpKzyFRMKKJYbG1SmTu8vNaWTh
M+45UozPa8vWnr7yBYndyj65oqhcams8DMgGqrZZL7ziuq/VgmPkYzcCefKBEFkL
PDIp0Af2zHnUA3XMO8Jhph0RkKRvn6dJyR3dEg1viP3Bhl6WsXqbQDkttkPvu5p0
/MFi+Db20L0YkijNZa0wWfxD8mVoVRgAsMpCue1Kx7Z71qt4Qs0fvYDfig8faQ0S
7TZuYi9GraRpoXgTOzxkon90dGJQ2jOXM0jg8TWpsiMy0wFt0ulJSE8u5Asb9rfo
GiqzXZhO9XAXZwI/oVWMwGzgnGTgn/HiPUue3h9f1jL2d/crr/ptJjQHViAKsXqj
ciPGX5w9sY4PVbcxfmBkWgRZLTMvOoPjivHChRcYOEHMIJzyfjeUY/tKwkdIspWy
h1G0bcEePM8EBg0s2mLDtRr0NSEWvOmBRYsCxhjob5WXY7z3OyseIZ/f5GWvbZXz
kUXQBAF0rjVf5rko7vG+mGMmKSyt7i12ITi8RFPNE1dkH/OAV0+H3vyittrPuNnd
R6uFOCBCmkOCdiD+Lc1Hl0Gekg6+wBnVHf835kIy0hF5kf0CTfHmmGOuu/Qfnv+W
a4hRnFIKermrjAufkBBiBiMHG5M/cNuqjhVhiHOKkvU8IgUz/AM=
=Mini
-----END PGP SIGNATURE-----

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Feb 26 13:27:44 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Update to 0.12.10. Check the NEWS file for the complete changelog.
- Drop patches. Issues fixed upstream:
* 0001-Restore-compatibility-with-GLib-2.58.patch
* 0001-Fix-possible-NULL-dereference.patch
* 0002-Don-t-ignore-xmlNodeDump-return-code.patch
* 0003-Fix-infinite-recursion-if-component-has-itself-liste.patch
* find-lmdb.patch
-------------------------------------------------------------------
Thu Dec 19 00:58:58 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package AppStream
#
# Copyright (c) 2019 SUSE LLC
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,7 +19,7 @@
%define libappstream_sover 4
%define libAppStreamQt_sover 2
Name: AppStream
Version: 0.12.7
Version: 0.12.10
Release: 0
Summary: Tools and libraries to work with AppStream metadata
License: GPL-2.0-or-later AND LGPL-2.1-or-later
@ -28,25 +28,19 @@ URL: https://www.freedesktop.org/software/appstream/docs/
Source0: http://www.freedesktop.org/software/appstream/releases/%{name}-%{version}.tar.xz
Source1: http://www.freedesktop.org/software/appstream/releases/%{name}-%{version}.tar.xz.asc
Source2: %{name}.keyring
# PATCH-FIX-UPSTREAM
Patch1: 0001-Restore-compatibility-with-GLib-2.58.patch
Patch2: 0001-Fix-possible-NULL-dereference.patch
Patch3: 0002-Don-t-ignore-xmlNodeDump-return-code.patch
Patch4: 0003-Fix-infinite-recursion-if-component-has-itself-liste.patch
# PATCH-FIX-UPSTREAM (https://github.com/ximion/appstream/issues/239)
Patch1000: find-lmdb.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: gettext
BuildRequires: gperf
BuildRequires: lmdb-devel
BuildRequires: meson >= 0.42
BuildRequires: meson >= 0.48
BuildRequires: pkgconfig
BuildRequires: xsltproc
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0) >= 2.46
BuildRequires: pkgconfig(glib-2.0) >= 2.58
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(libsoup-2.4)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(vapigen)
BuildRequires: pkgconfig(yaml-0.1)

View File

@ -1,18 +0,0 @@
From: Fabian Vogt <fabian@ritter-vogt.de>
Subject: Find LMDB without pkg-config or CMake
Upstream LMDB provides neither.
Index: AppStream-0.12.7/meson.build
===================================================================
--- AppStream-0.12.7.orig/meson.build
+++ AppStream-0.12.7/meson.build
@@ -66,7 +66,7 @@ gio_dep = dependency('gio-2.0', version
gio_unix_dep = dependency('gio-unix-2.0', version : '>=2.54')
xml2_dep = dependency('libxml-2.0')
yaml_dep = dependency('yaml-0.1')
-lmdb_dep = dependency('lmdb')
+lmdb_dep = meson.get_compiler('c').find_library('lmdb')
if get_option ('gir')
# ensure we have a version of GIR that isn't broken with Meson