Bug#1037214: bullseye-pu: package appstream-glib/0.7.18-1+deb11u1

2023-06-20 Thread Simon McVittie
Control: tags -1 - moreinfo

On Sat, 17 Jun 2023 at 18:45:31 +0200, Matthias Klumpp wrote:
> Thank you for working on this! It will be nice to have this issue
> fixed in bullseye soon, as it seems to affect quite a bunch of users!

I've assumed that counts as a "yes" from the maintainer, and uploaded
the proposed version for the stable release team's review.

Thanks,
smcv



Bug#1037214: bullseye-pu: package appstream-glib/0.7.18-1+deb11u1

2023-06-17 Thread Matthias Klumpp
Am Do., 8. Juni 2023 um 21:18 Uhr schrieb Simon McVittie :
>
> On Wed, 07 Jun 2023 at 21:33:29 +0100, Simon McVittie wrote:
> >   [x] attach debdiff against the package in (old)stable
>
> That was, in fact, a lie. See attached (or the nmudiff on #1037206 if
> you'd prefer the unfiltered version).

Thank you for working on this! It will be nice to have this issue
fixed in bullseye soon, as it seems to affect quite a bunch of users!

Cheers,
Matthias

-- 
I welcome VSRE emails. See http://vsre.info/



Bug#1037214: bullseye-pu: package appstream-glib/0.7.18-1+deb11u1

2023-06-08 Thread Simon McVittie
On Wed, 07 Jun 2023 at 21:33:29 +0100, Simon McVittie wrote:
>   [x] attach debdiff against the package in (old)stable

That was, in fact, a lie. See attached (or the nmudiff on #1037206 if
you'd prefer the unfiltered version).

smcv
debdiff appstream-glib_0.7.18-1{,+deb11u1}.dsc | filterdiff -p1 -x'debian/patches/*.patch'

diffstat for appstream-glib-0.7.18 appstream-glib-0.7.18

 debian/.gitignore |1 
 debian/changelog  |   10 
 debian/patches/Improve-handling-of-em-and-code-tags.patch |  220 ++
 debian/patches/Properly-initialize-AsNodeToXmlHelper.patch|   34 +
 debian/patches/Support-em-code-tags.patch |  118 +
 debian/patches/series |4 
 debian/patches/trivial-Turn-is_-em-code-_text-fields-into-bitfields.patch |   26 +
 libappstream-glib/as-node.c   |  120 -
 libappstream-glib/as-self-test.c  |   51 ++
 9 files changed, 552 insertions(+), 32 deletions(-)

diff -Nru appstream-glib-0.7.18/debian/changelog appstream-glib-0.7.18/debian/changelog
--- appstream-glib-0.7.18/debian/changelog	2020-12-21 23:14:10.0 +
+++ appstream-glib-0.7.18/debian/changelog	2023-06-07 19:25:59.0 +0100
@@ -1,3 +1,13 @@
+appstream-glib (0.7.18-1+deb11u1) bullseye; urgency=medium
+
+  * Add patches from upstream to cope with  and  in metadata.
+Older versions of appstream-glib mis-parse upstream metadata that
+contains  and , causing flatpak 1.12.x or older to fail
+to load the metadata now published by Flathub. The symptom is that
+`flatpak search` fails. (Closes: #1037206, LP: #2023215)
+
+ -- Simon McVittie   Wed, 07 Jun 2023 19:25:59 +0100
+
 appstream-glib (0.7.18-1) unstable; urgency=medium
 
   [ Matthias Klumpp ]
diff -Nru appstream-glib-0.7.18/debian/.gitignore appstream-glib-0.7.18/debian/.gitignore
--- appstream-glib-0.7.18/debian/.gitignore	1970-01-01 01:00:00.0 +0100
+++ appstream-glib-0.7.18/debian/.gitignore	2023-06-07 19:25:59.0 +0100
@@ -0,0 +1 @@
+*~
diff -Nru appstream-glib-0.7.18/debian/patches/series appstream-glib-0.7.18/debian/patches/series
--- appstream-glib-0.7.18/debian/patches/series	1970-01-01 01:00:00.0 +0100
+++ appstream-glib-0.7.18/debian/patches/series	2023-06-07 19:25:59.0 +0100
@@ -0,0 +1,4 @@
+Support-em-code-tags.patch
+Properly-initialize-AsNodeToXmlHelper.patch
+trivial-Turn-is_-em-code-_text-fields-into-bitfields.patch
+Improve-handling-of-em-and-code-tags.patch
diff -Nru appstream-glib-0.7.18/libappstream-glib/as-node.c appstream-glib-0.7.18/libappstream-glib/as-node.c
--- appstream-glib-0.7.18/libappstream-glib/as-node.c	2020-09-07 11:20:43.894573000 +0100
+++ appstream-glib-0.7.18/libappstream-glib/as-node.c	2023-06-07 20:58:11.0 +0100
@@ -555,6 +555,8 @@
 	AsNode			*current;
 	AsNodeFromXmlFlags	 flags;
 	const gchar * const	*locales;
+	guint8			 is_em_text:1;
+	guint8			 is_code_text:1;
 } AsNodeToXmlHelper;
 
 /**
@@ -604,6 +606,16 @@
 	AsNode *current;
 	guint i;
 
+	/* do not create a child node for em and code tags */
+	if (g_strcmp0 (element_name, "em") == 0) {
+		helper->is_em_text = 1;
+		return;
+	}
+	if (g_strcmp0 (element_name, "code") == 0) {
+		helper->is_code_text = 1;
+		return;
+	}
+
 	/* check if we should ignore the locale */
 	data = g_slice_new0 (AsNodeData);
 
@@ -662,6 +674,53 @@
 			GError **error)
 {
 	AsNodeToXmlHelper *helper = (AsNodeToXmlHelper *) user_data;
+	AsNodeData *data = helper->current->data;
+
+	/* do not create a child node for em and code tags */
+	if (g_strcmp0 (element_name, "em") == 0) {
+		helper->is_em_text = 0;
+		return;
+	}
+	if (g_strcmp0 (element_name, "code") == 0) {
+		helper->is_code_text = 0;
+		return;
+	}
+
+	if (data->cdata != NULL) {
+		/* split up into lines and add each with spaces stripped */
+		if ((helper->flags & AS_NODE_FROM_XML_FLAG_LITERAL_TEXT) == 0) {
+			AsRefString *cdata = data->cdata;
+			data->cdata = as_node_reflow_text (cdata, strlen (cdata));
+			as_ref_string_unref (cdata);
+		}
+
+		/* intern commonly duplicated tag values and save a bit of memory */
+		if (data->is_tag_valid) {
+			AsNode *root = g_node_get_root (helper->current);
+			switch (data->tag) {
+			case AS_TAG_CATEGORY:
+			case AS_TAG_COMPULSORY_FOR_DESKTOP:
+			case AS_TAG_CONTENT_ATTRIBUTE:
+			case AS_TAG_DEVELOPER_NAME:
+			case AS_TAG_EXTENDS:
+			case AS_TAG_ICON:
+			case AS_TAG_ID:
+			case AS_TAG_KUDO:
+			case AS_TAG_LANG:
+			case AS_TAG_METADATA_LICENSE:
+			case AS_TAG_MIMETYPE:
+			case AS_TAG_PROJECT_GROUP:
+			case AS_TAG_PROJECT_LICENSE:
+			case AS_TAG_SOURCE_PKGNAME:
+			case AS_TAG_URL:
+as_node_cdata_to_intern (root, data);
+break;
+			default:
+break;
+			}
+		}
+	}
+
 	helper->current = 

Bug#1037214: bullseye-pu: package appstream-glib/0.7.18-1+deb11u1

2023-06-07 Thread Simon McVittie
Package: release.debian.org
Severity: normal
Tags: bullseye moreinfo
User: release.debian@packages.debian.org
Usertags: pu
X-Debbugs-Cc: appstream-g...@packages.debian.org
Control: affects -1 + src:appstream-glib

[ Reason ]
Recent server-side changes on flathub.org mean that it started publishing
Appstream metadata that appstream-glib doesn't understand ( and 
markup), and appstream-glib is intolerant of non-recognised markup in
this context, causing `flatpak search` to regress in bullseye. (#1037206)

[ Impact ]
If not fixed, `flatpak search` will show an error message for Flathub
users and not offer any search results, unless the user upgrades to
the version from bullseye-backports (which is unaffected by appstream-glib
bugs because it has switched to using libappstream, a different codebase).

[ Tests ]
I confirmed that this fixes the reproducer from #1037206.

bullseye's gnome-software, which uses appstream-glib, is still able
to display search results from both Debian (I searched for amoebax)
and Flathub (I searched for steamlink and organicmaps). The package
description for organicmaps, which includes  and therefore triggered
this bug, is not displayed correctly in gnome-software (text inside 
doesn't appear), but that isn't a regression: the same behaviour is seen
without this change.

The patches also add a regression test, which is run at build-time
and passes.

[ Risks ]
These are straightforward backports from the newer upstream release in
bookworm, and have also been proposed for an Ubuntu 22.04 stable update.
The original change introduced a test failure, for which the subsequent
upstream fix is also included.

I've marked this as moreinfo because it should ideally be reviewed by the
package's maintainer (not me).

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
All changes are part of solving #1037206.