aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiona Klute <fiona.klute@gmx.de>2022-09-22 22:31:20 +0200
committerFiona Klute <fiona.klute@gmx.de>2022-09-22 22:31:20 +0200
commitecbc535f753b214faa89b70edf11065b10dd152b (patch)
tree3d7d3126c79ce9725306c5b0dc11d60fc03b50d9
parente2ef8928247b9d6e8b0679676b16ec16ee8f7843 (diff)
downloadaports-ecbc535f753b214faa89b70edf11065b10dd152b.tar.gz
aports-ecbc535f753b214faa89b70edf11065b10dd152b.tar.bz2
aports-ecbc535f753b214faa89b70edf11065b10dd152b.tar.xz
community/phosh: Fixes for glib 2.74 compatibility
The patches come from this (merged) upstream MR: https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1148 They fix a crash on any (!) notification, and unit test failures that happen with glib 2.74: https://gitlab.com/postmarketOS/pmaports/-/issues/1706 https://gitlab.gnome.org/World/Phosh/phosh/-/issues/840 https://gitlab.gnome.org/World/Phosh/phosh/-/issues/841
-rw-r--r--community/phosh/0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch176
-rw-r--r--community/phosh/0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch45
-rw-r--r--community/phosh/0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch54
-rw-r--r--community/phosh/APKBUILD8
4 files changed, 282 insertions, 1 deletions
diff --git a/community/phosh/0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch b/community/phosh/0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch
new file mode 100644
index 0000000000..d31f551f04
--- /dev/null
+++ b/community/phosh/0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch
@@ -0,0 +1,176 @@
+From 4a9e447c49729ed893ac37749ec1b8598a11695c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
+Date: Thu, 22 Sep 2022 12:39:22 +0200
+Subject: [PATCH 1/3] log: Track log domains instead of passing it to the
+ handler as user data
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This will allow us to not set the handler multiple times in the
+next commit.
+
+Signed-off-by: Guido G√ľnther <guido.gunther@puri.sm>
+Part-of: <https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1148>
+---
+ src/log.c | 39 ++++++++++++++++++++++------------
+ src/main.c | 1 +
+ tests/test-gtk-mount-manager.c | 1 +
+ tests/test-idle-manager.c | 1 +
+ tests/testlib-full-shell.c | 1 +
+ 5 files changed, 30 insertions(+), 13 deletions(-)
+
+diff --git a/src/log.c b/src/log.c
+index cb2dde08..8e6770b2 100644
+--- a/src/log.c
++++ b/src/log.c
+@@ -18,6 +18,10 @@
+ /* these are filtered by G_MESSAGES_DEBUG by the default log handler */
+ #define INFO_LEVELS (G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG)
+
++
++static char *_log_domains;
++G_LOCK_DEFINE_STATIC (_log_domains);
++
+ static gboolean
+ log_is_old_api (const GLogField *fields,
+ gsize n_fields)
+@@ -42,7 +46,7 @@ static GLogWriterOutput
+ phosh_log_writer_default (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+- gchar *log_domains)
++ gpointer unused)
+ {
+ static gsize initialized = 0;
+ static gboolean stderr_is_journal = FALSE;
+@@ -51,12 +55,15 @@ phosh_log_writer_default (GLogLevelFlags log_level,
+ g_return_val_if_fail (fields != NULL, G_LOG_WRITER_UNHANDLED);
+ g_return_val_if_fail (n_fields > 0, G_LOG_WRITER_UNHANDLED);
+
+- /* Disable debug message output unless specified in log_domains. */
++ G_LOCK (_log_domains);
++
++ /* Disable debug message output unless specified in _log_domains. */
+ if (!(log_level & DEFAULT_LEVELS) && !(log_level >> G_LOG_LEVEL_USER_SHIFT)) {
+ const gchar *log_domain = NULL;
+ gsize i;
+
+- if ((log_level & INFO_LEVELS) == 0 || log_domains == NULL) {
++ if ((log_level & INFO_LEVELS) == 0 || _log_domains == NULL) {
++ G_UNLOCK (_log_domains);
+ return G_LOG_WRITER_HANDLED;
+ }
+
+@@ -67,8 +74,9 @@ phosh_log_writer_default (GLogLevelFlags log_level,
+ }
+ }
+
+- if (strcmp (log_domains, "all") != 0 &&
+- (log_domain == NULL || !strstr (log_domains, log_domain))) {
++ if (strcmp (_log_domains, "all") != 0 &&
++ (log_domain == NULL || !strstr (_log_domains, log_domain))) {
++ G_UNLOCK (_log_domains);
+ return G_LOG_WRITER_HANDLED;
+ }
+ }
+@@ -88,14 +96,15 @@ phosh_log_writer_default (GLogLevelFlags log_level,
+ }
+
+ if (stderr_is_journal &&
+- g_log_writer_journald (log_level, fields, n_fields, log_domains) ==
++ g_log_writer_journald (log_level, fields, n_fields, _log_domains) ==
+ G_LOG_WRITER_HANDLED)
+ goto handled;
+
+- if (g_log_writer_standard_streams (log_level, fields, n_fields, log_domains) ==
++ if (g_log_writer_standard_streams (log_level, fields, n_fields, _log_domains) ==
+ G_LOG_WRITER_HANDLED)
+ goto handled;
+
++ G_UNLOCK (_log_domains);
+ return G_LOG_WRITER_UNHANDLED;
+
+ handled:
+@@ -104,21 +113,25 @@ handled:
+ _phosh_log_abort (!(log_level & G_LOG_FLAG_RECURSION));
+ }
+
++ G_UNLOCK (_log_domains);
+ return G_LOG_WRITER_HANDLED;
+ }
+
+ /**
+ * phosh_log_set_log_domains:
+- * @domains: comma separated list of log domains. This string must
+- * remain valid during the programs life time.
++ * @domains: comma separated list of log domains.
+ *
+- * Set the current logging domains.
++ * Set the current logging domains. This sets an appropriate log
++ * handler as well.
+ */
+ void
+ phosh_log_set_log_domains (const char *domains)
+ {
+- /* We replace the whole writer instead of just updating domains
+- since that is already mutex protected */
++ G_LOCK (_log_domains);
++ g_free (_log_domains);
++ _log_domains = g_strdup (domains);
++ G_UNLOCK (_log_domains);
++
+ g_log_set_writer_func ((GLogWriterFunc)phosh_log_writer_default,
+- (char*)domains, NULL);
++ NULL, NULL);
+ }
+diff --git a/src/main.c b/src/main.c
+index 6f10f261..3d05841e 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -142,5 +142,6 @@ int main(int argc, char *argv[])
+
+ cui_uninit ();
+
++ phosh_log_set_log_domains (NULL);
+ return EXIT_SUCCESS;
+ }
+diff --git a/tests/test-gtk-mount-manager.c b/tests/test-gtk-mount-manager.c
+index 0f6f1c20..8b3f1c3a 100644
+--- a/tests/test-gtk-mount-manager.c
++++ b/tests/test-gtk-mount-manager.c
+@@ -84,6 +84,7 @@ comp_and_shell_thread (gpointer data)
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
++ phosh_log_set_log_domains (NULL);
+ return NULL;
+ }
+
+diff --git a/tests/test-idle-manager.c b/tests/test-idle-manager.c
+index fca66182..309eeae5 100644
+--- a/tests/test-idle-manager.c
++++ b/tests/test-idle-manager.c
+@@ -82,6 +82,7 @@ comp_and_shell_thread (gpointer data)
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
++ phosh_log_set_log_domains (NULL);
+ return NULL;
+ }
+
+diff --git a/tests/testlib-full-shell.c b/tests/testlib-full-shell.c
+index 0f4c8604..1948f82a 100644
+--- a/tests/testlib-full-shell.c
++++ b/tests/testlib-full-shell.c
+@@ -82,6 +82,7 @@ phosh_test_full_shell_thread (gpointer data)
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
++ phosh_log_set_log_domains (NULL);
+ return NULL;
+ }
+
+--
+2.37.2
+
diff --git a/community/phosh/0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch b/community/phosh/0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch
new file mode 100644
index 0000000000..34750c1991
--- /dev/null
+++ b/community/phosh/0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch
@@ -0,0 +1,45 @@
+From b30ef98044b61c069cf12b502d6fb13a50e63936 Mon Sep 17 00:00:00 2001
+From: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu>
+Date: Wed, 21 Sep 2022 08:30:52 +0200
+Subject: [PATCH 2/3] log: Guard against setting g_log_set_writer_func()
+ multiple times
+
+While it was always invalid it is enforced as of glib 2.74.
+
+This fixes tests failing like:
+
+GLib-ERROR **: 08:25:34.271: g_log_set_writer_func() called multiple times
+
+Closes: https://gitlab.gnome.org/World/Phosh/phosh/-/issues/841
+Part-of: <https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1148>
+---
+ src/log.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/log.c b/src/log.c
+index 8e6770b2..c2372e5a 100644
+--- a/src/log.c
++++ b/src/log.c
+@@ -18,7 +18,7 @@
+ /* these are filtered by G_MESSAGES_DEBUG by the default log handler */
+ #define INFO_LEVELS (G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG)
+
+-
++static gboolean _log_writer_func_set;
+ static char *_log_domains;
+ G_LOCK_DEFINE_STATIC (_log_domains);
+
+@@ -132,6 +132,10 @@ phosh_log_set_log_domains (const char *domains)
+ _log_domains = g_strdup (domains);
+ G_UNLOCK (_log_domains);
+
++ if (_log_writer_func_set)
++ return;
++
+ g_log_set_writer_func ((GLogWriterFunc)phosh_log_writer_default,
+ NULL, NULL);
++ _log_writer_func_set = TRUE;
+ }
+--
+2.37.2
+
diff --git a/community/phosh/0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch b/community/phosh/0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch
new file mode 100644
index 0000000000..b028874dc6
--- /dev/null
+++ b/community/phosh/0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch
@@ -0,0 +1,54 @@
+From 9375f72b2e22a588c7dc39dfef8fe9b46d936d03 Mon Sep 17 00:00:00 2001
+From: Fiona Klute <fiona.klute@gmx.de>
+Date: Mon, 19 Sep 2022 21:18:37 +0200
+Subject: [PATCH 3/3] util: Don't use G_REGEX_JAVASCRIPT_COMPAT
+
+G_REGEX_JAVASCRIPT_COMPAT is unsupported as of glib 2.74 and
+not needed for the regex at hand.
+
+G_REGEX_DEFAULT is the preferable default but not available before
+glib 2.73.2, so there's a fallback to 0 for earlier versions.
+
+Closes: https://gitlab.gnome.org/World/Phosh/phosh/-/issues/840
+Part-of: <https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1148>
+---
+ src/util.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/util.c b/src/util.c
+index 746e5e70..f2a55e5c 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -19,6 +19,11 @@
+ #include <fcntl.h>
+
+
++#if !GLIB_CHECK_VERSION(2, 73, 2)
++#define G_REGEX_DEFAULT 0
++#endif
++
++
+ static gboolean have_gnome_software = -1;
+
+
+@@ -401,7 +406,7 @@ phosh_util_escape_markup (const char *markup, gboolean allow_markup)
+ /* Escape &whatever; */
+ /* Support &amp;, &quot;, &apos;, &lt; and &gt;, escape all other occurrences of '&'. */
+ amp_re = g_regex_new ("&(?!amp;|quot;|apos;|lt;|gt;)",
+- G_REGEX_JAVASCRIPT_COMPAT,
++ G_REGEX_DEFAULT,
+ 0,
+ &err);
+ if (!amp_re) {
+@@ -426,7 +431,7 @@ phosh_util_escape_markup (const char *markup, gboolean allow_markup)
+ * https://specifications.freedesktop.org/notification-spec/latest/ar01s04.html
+ */
+ elem_re = g_regex_new ("<(?!/?[biu]>)",
+- G_REGEX_JAVASCRIPT_COMPAT,
++ G_REGEX_DEFAULT,
+ 0,
+ &err);
+ if (!elem_re) {
+--
+2.37.2
+
diff --git a/community/phosh/APKBUILD b/community/phosh/APKBUILD
index 8a9beda76f..03e0a37836 100644
--- a/community/phosh/APKBUILD
+++ b/community/phosh/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=phosh
pkgver=0.21.0
-pkgrel=0
+pkgrel=1
pkgdesc="Shell PoC for the Librem5"
# Blocked on s390x by gnome-session, gnome-settings-daemon, squeekboard and libhandy
# Blocked on ppc64le by gnome-session
@@ -56,6 +56,9 @@ subpackages="$pkgname-dbg $pkgname-lang"
source="https://download.gnome.org/sources/phosh/${pkgver%.*}/phosh-$pkgver.tar.xz
phosh.desktop
sm.puri.OSK0.desktop
+ 0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch
+ 0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch
+ 0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch
"
build() {
@@ -84,4 +87,7 @@ sha512sums="
ce15eb687008463246ce80a72eb88ca69c93db1be457252926564f9a94e25f1b20d6b6a07705635aa1393696788140cc3cbc994bdeb679e05837dba6af51135c phosh-0.21.0.tar.xz
aef856033ae17bc8e18963ea56aad34e6e0d262d0060f9b5aa9f072c7598d531ee9a55b189d6fadf7e6f3c5dd113b77de51a64bcf17ad5764ff57a4be8472dc7 phosh.desktop
52a670893bd5027d6a45d7ff18258d634dc5d98371a7cdc094261ccc12a15d0b46e96d572ae8882ae27eb90418f2dc4f0fb1a45ce95f8d70eadc51d284780916 sm.puri.OSK0.desktop
+7a3ae844b5db674f59b5760abe7f3d356178dd945d6a5b3b0f83f4c118b61f7fb3cb2e947eefd69dc1ead6f149aa7dd4dabaeef128f31452a6e5a9a823c17e03 0001-log-Track-log-domains-instead-of-passing-it-to-the-h.patch
+54745276607db51e1eb0c8d98d56cef8ebc45914f961aab8758fa54f6281213e0ac68e925332af792bd5940258b3065d96240503272c514aeb28b8fc3fbf5dc6 0002-log-Guard-against-setting-g_log_set_writer_func-mult.patch
+63ed6d242d9fb7086226a9ecd5dc9fdaeb260d175f3195f63f917e5be2b0dee5efbf56bf5e254e23233a5d718cf3f74c3d0c0d1496ad8575c43832c50aca9c6a 0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch
"