From d2d8da20d10f5f1236861589d39576e20f022928 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 16 Jan 2022 18:45:07 +0000 Subject: [PATCH] Revert and rebuild --- rest-0.8.0-fix-the-XML-test.patch | 218 ++++++++++++++++++++++++++++++ rest.spec | 51 ++++--- sources | 2 +- 3 files changed, 251 insertions(+), 20 deletions(-) create mode 100644 rest-0.8.0-fix-the-XML-test.patch diff --git a/rest-0.8.0-fix-the-XML-test.patch b/rest-0.8.0-fix-the-XML-test.patch new file mode 100644 index 0000000..44ca0cc --- /dev/null +++ b/rest-0.8.0-fix-the-XML-test.patch @@ -0,0 +1,218 @@ +From a09ea6bd74d6234be8456e7039403bc1c1d078bd Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Mon, 20 Jun 2016 12:05:48 +0200 +Subject: [PATCH 1/4] xml-node: Use GString in rest_xml_node_print() + +The current code is using xml = g_strconcat (xml, ...) which is causing +some leaks as g_strconcat returns a newly allocated string. Using +GString avoids this issue without constantly freeing the intermediate +strings. + +This fixes multiple leaks like: + +==16611== 18 bytes in 1 blocks are definitely lost in loss record 124 of 301 +==16611== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) +==16611== by 0x5F5CE58: g_malloc (gmem.c:94) +==16611== by 0x5F75B8E: g_strconcat (gstrfuncs.c:585) +==16611== by 0x4E450CF: rest_xml_node_print (rest-xml-node.c:287) +==16611== by 0x4E451DA: rest_xml_node_print (rest-xml-node.c:305) +==16611== by 0x4E450F8: rest_xml_node_print (rest-xml-node.c:292) +==16611== by 0x4009A0: main (xml.c:40) +--- + rest/rest-xml-node.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/rest/rest-xml-node.c b/rest/rest-xml-node.c +index 57a942667f06..a8156dbbd432 100644 +--- a/rest/rest-xml-node.c ++++ b/rest/rest-xml-node.c +@@ -283,38 +283,41 @@ rest_xml_node_print (RestXmlNode *node) + { + GHashTableIter iter; + gpointer key, value; +- char *xml = g_strconcat ("<", node->name, NULL); ++ GString *xml = g_string_new (NULL); + RestXmlNode *n; + ++ g_string_append (xml, "<"); ++ g_string_append (xml, node->name); ++ + g_hash_table_iter_init (&iter, node->attrs); + while (g_hash_table_iter_next (&iter, &key, &value)) +- xml = g_strconcat (xml, " ", key, "=\'", value, "\'", NULL); ++ g_string_append_printf (xml, " %s =\'%s\'", (char *)key, (char *)value); + +- xml = g_strconcat (xml, ">", NULL); ++ g_string_append (xml, ">"); + + g_hash_table_iter_init (&iter, node->children); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + char *child = rest_xml_node_print ((RestXmlNode *) value); + +- xml = g_strconcat (xml, child, NULL); ++ g_string_append (xml, child); + g_free (child); + } + + if (node->content) +- xml = g_strconcat (xml, node->content, "name, ">", NULL); +- else +- xml = g_strconcat (xml, "name, ">", NULL); ++ g_string_append (xml, node->content); ++ ++ g_string_append_printf (xml, "", node->name); + + for (n = node->next; n; n = n->next) + { + char *sibling = rest_xml_node_print (n); + +- xml = g_strconcat (xml, sibling, NULL); ++ g_string_append (xml, sibling); + g_free (sibling); + } + +- return xml; ++ return g_string_free (xml, FALSE); + } + + /** +-- +2.14.2 + + +From a34d02947c4f102e6d16b9d328941a4b2946c8e8 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 13 Oct 2017 18:53:39 +0200 +Subject: [PATCH 2/4] xml-node: Remove stray blank space + +This had broken tests/xml.c. + +Fallout from 61a7b231bd8b9d1b8d02dca120389e79d38b428d + +https://bugzilla.gnome.org/show_bug.cgi?id=788960 +--- + rest/rest-xml-node.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rest/rest-xml-node.c b/rest/rest-xml-node.c +index a8156dbbd432..d3a7c995affd 100644 +--- a/rest/rest-xml-node.c ++++ b/rest/rest-xml-node.c +@@ -291,7 +291,7 @@ rest_xml_node_print (RestXmlNode *node) + + g_hash_table_iter_init (&iter, node->attrs); + while (g_hash_table_iter_next (&iter, &key, &value)) +- g_string_append_printf (xml, " %s =\'%s\'", (char *)key, (char *)value); ++ g_string_append_printf (xml, " %s=\'%s\'", (char *)key, (char *)value); + + g_string_append (xml, ">"); + +-- +2.14.2 + + +From f184db2bff0618b99c4de3316082fe80439f124c Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 13 Oct 2017 19:14:16 +0200 +Subject: [PATCH 3/4] xml-node: Define the order in which attributes & children + are printed + +The order in which GHashTable returns its key-value pairs is undefined. +Therefore the output of rest_xml_node_print can change based on the +GHashTable implementation. While not strictly necessary, it would be +nice to avoid that. Having a stable order, even if it is not +documented and depends on the current RestXmlNode code, is handy for +testing. + +This was the main reason behind the tests/xml.c breakage. + +https://bugzilla.gnome.org/show_bug.cgi?id=788960 +--- + rest/rest-xml-node.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/rest/rest-xml-node.c b/rest/rest-xml-node.c +index d3a7c995affd..973ebcf6c3fa 100644 +--- a/rest/rest-xml-node.c ++++ b/rest/rest-xml-node.c +@@ -283,6 +283,9 @@ rest_xml_node_print (RestXmlNode *node) + { + GHashTableIter iter; + gpointer key, value; ++ GList *attrs = NULL; ++ GList *children = NULL; ++ GList *l; + GString *xml = g_string_new (NULL); + RestXmlNode *n; + +@@ -291,13 +294,29 @@ rest_xml_node_print (RestXmlNode *node) + + g_hash_table_iter_init (&iter, node->attrs); + while (g_hash_table_iter_next (&iter, &key, &value)) +- g_string_append_printf (xml, " %s=\'%s\'", (char *)key, (char *)value); ++ { ++ char *attr = g_strdup_printf ("%s=\'%s\'", (char *)key, (char *)value); ++ attrs = g_list_prepend (attrs, attr); ++ } ++ ++ attrs = g_list_sort (attrs, (GCompareFunc) g_strcmp0); ++ for (l = attrs; l; l = l->next) ++ { ++ const char *attr = (const char *) l->data; ++ g_string_append_printf (xml, " %s", attr); ++ } + + g_string_append (xml, ">"); + + g_hash_table_iter_init (&iter, node->children); + while (g_hash_table_iter_next (&iter, &key, &value)) ++ children = g_list_prepend (children, key); ++ ++ children = g_list_sort (children, (GCompareFunc) g_strcmp0); ++ for (l = children; l; l = l->next) + { ++ const char *name = (const char *) l->data; ++ RestXmlNode *value = (RestXmlNode *) g_hash_table_lookup (node->children, name); + char *child = rest_xml_node_print ((RestXmlNode *) value); + + g_string_append (xml, child); +@@ -317,6 +336,8 @@ rest_xml_node_print (RestXmlNode *node) + g_free (sibling); + } + ++ g_list_free_full (attrs, g_free); ++ g_list_free (children); + return g_string_free (xml, FALSE); + } + +-- +2.14.2 + + +From e5ee6ef751ee5a38d7b9fadcd631cf6ecec7b240 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 13 Oct 2017 19:16:55 +0200 +Subject: [PATCH 4/4] tests: Re-enable the XML test + +This reverts commit 2d1dbfe7073b1e153ff881426b40a9a517fb796b + +https://bugzilla.gnome.org/show_bug.cgi?id=788960 +--- + tests/Makefile.am | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 5d77f9cf5445..5ffdd4634e9a 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -1,6 +1,4 @@ + TESTS = proxy proxy-continuous threaded oauth oauth-async oauth2 flickr lastfm xml custom-serialize +-# TODO: fix this test case +-XFAIL_TESTS = xml + + AM_CPPFLAGS = $(SOUP_CFLAGS) -I$(top_srcdir) $(GCOV_CFLAGS) + AM_LDFLAGS = $(SOUP_LIBS) $(GCOV_LDFLAGS) \ +-- +2.14.2 + diff --git a/rest.spec b/rest.spec index 58c8207..ed8736e 100644 --- a/rest.spec +++ b/rest.spec @@ -1,20 +1,24 @@ Name: rest -Version: 0.9.0 -Release: 1%{?dist} +Version: 0.8.1 +Release: 11%{?dist} Summary: A library for access to RESTful web services License: LGPLv2 URL: http://www.gnome.org -Source0: http://download.gnome.org/sources/%{name}/0.9/%{name}-%{version}.tar.xz +Source0: http://download.gnome.org/sources/%{name}/0.8/%{name}-%{version}.tar.xz -BuildRequires: cmake +# https://bugzilla.redhat.com/show_bug.cgi?id=1445700 +Patch0: rest-0.8.0-fix-the-XML-test.patch + +BuildRequires: make BuildRequires: glib2-devel BuildRequires: gobject-introspection-devel BuildRequires: libsoup-devel BuildRequires: libxml2-devel -BuildRequires: gi-docgen -BuildRequires: json-glib-devel -BuildRequires: meson +BuildRequires: gtk-doc +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool %description This library was designed to make it easier to access web services that @@ -33,14 +37,17 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Files for development with %{name}. %prep -%autosetup -p1 +%setup -q +%patch0 -p1 %build -%meson -%meson_build +autoreconf -vif +%configure --disable-static --enable-gtk-doc --enable-introspection=yes + +make %{?_smp_mflags} V=1 %install -%meson_install +make install DESTDIR=%{buildroot} INSTALL='install -p' #Remove libtool archives. find %{buildroot} -type f -name "*.la" -delete @@ -50,19 +57,25 @@ find %{buildroot} -type f -name "*.la" -delete %files %license COPYING %doc AUTHORS README -%{_libdir}/librest*1.0.so.0* -%{_libdir}/girepository-1.0/Rest*1.0.typelib +%{_libdir}/librest-0.7.so.0 +%{_libdir}/librest-0.7.so.0.0.0 +%{_libdir}/librest-extras-0.7.so.0 +%{_libdir}/librest-extras-0.7.so.0.0.0 +%{_libdir}/girepository-1.0/Rest-0.7.typelib +%{_libdir}/girepository-1.0/RestExtras-0.7.typelib %files devel -%{_includedir}/rest-1.0 +%{_includedir}/rest-0.7 %{_libdir}/pkgconfig/rest* -%{_libdir}/librest*1.0.so -%{_docdir}/librest-1.0/ -%{_datadir}/gir-1.0/Rest*1.0.gir +%{_libdir}/librest-0.7.so +%{_libdir}/librest-extras-0.7.so +%{_datadir}/gtk-doc/html/%{name}*0.7 +%{_datadir}/gir-1.0/Rest-0.7.gir +%{_datadir}/gir-1.0/RestExtras-0.7.gir %changelog -* Sun Jan 16 2022 Peter Robinson - 0.9.0-1 -- Update to 0.9 +* Sun Jan 16 2022 Peter Robinson - 0.8.1-11 +- Rebuild * Fri Jul 23 2021 Fedora Release Engineering - 0.8.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index ede22df..4aa31c7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rest-0.9.0.tar.xz) = 7392dc2b9d90b5140eca0e00c634749cbc3a0780d223da18abe40ddab7570a932746b163fd2f83f15e33e3faa178dc37b041bcb85bd5a18756a122c164c9f84c +SHA512 (rest-0.8.1.tar.xz) = 824a341db3827e4360abe03e33735918c68913c70d797699ef74271080a1985872006ec70fd994dc8fa3fbfef417e6fe979883c11286512d0ce623b8368e40c3