diff options
46 files changed, 1123 insertions, 227 deletions
@@ -1,3 +1,23 @@ +Overview of changes in GLib 2.80.2, 2024-05-08 +============================================== + +* Fix a regression with IBus caused by the fix for CVE-2024-34397 (#3353, + work by Simon McVittie) + +* Fix installation directory of the GVariant specification (#3351, work by + Michael Catanzaro) + +* Bugs fixed: + - #3351 GVariant specification installed in wrong directory (Michael + Catanzaro) + - #3353 Fixing CVE-2024-34397 caused regressions for ibus (Simon McVittie) + - !4052 Backport "gdbusconnection: Fix test signal subscription ordering" to + glib-2-80 + - !4054 Backport !4049 “Correct installation directory of GVariant + specification” to glib-2-80 + - !4055 Backport !4053 “gdbusconnection: Allow name owners to have the syntax + of a well-known name” to glib-2-80 + Overview of changes in GLib 2.80.1, 2024-05-07 ============================================== diff --git a/debian/changelog b/debian/changelog index 7fcd94e12..fcc1661fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,39 @@ +glib2.0 (2.80.2-2) unstable; urgency=medium + + * d/patches: Update to upstream glib-2-80 branch commit + 2.80.2-25-g197e2690e, excluding CI-only changes + - Fix memory errors in GActionGroupExporter and GMenuExporter + error-handling code paths since 2.80.1 (Closes: #1071690) + - Fix memory leaks in early-return code paths when trashing a local file + - Fix memory leaks in several tests + - Fix FTBFS on -ports architectures with unusual alignment, such as m68k + - Fix compiler warnings with gcc 14 + - Improve dependencies between build targets + * d/control: Add missing libgir…-2.0-dev Depends on libgir…-2.0-0 + + -- Simon McVittie <smcv@debian.org> Fri, 24 May 2024 12:21:09 +0100 + +glib2.0 (2.80.2-1) unstable; urgency=medium + + * New upstream stable release + * d/p/gdbusconnection-Fix-test-signal-subscription-ordering.patch, + d/p/gdbusconnection-Allow-name-owners-to-have-the-syntax-of-a.patch: + Drop patches that were included upstream + * d/p/gdbusmessage-Clean-the-cached-arg0-when-setting-the-messa.patch: + Add patch from upstream to fix a memory leak introduced in 2.80.0 + * d/libglib2.0-doc.*: Adjust for move of GVariant specification into + glib-2.0/ + * d/changelog: Remove some inaccurate text from the 2.80.0-10 entry. + Fixing CVE-2024-34397 in older branches required some backported + changes from 2.80.x, but in 2.80.x those changes were already present + upstream, so it was incorrect to list them as being new in 2.80.0-10. + * d/control: Fix cross-references from lib*-dev to gir1.2-*-dev + in package descriptions. + Now that we ship the .gir files in their own packages, + libgirepository1.0-dev is usually no longer necessary. + + -- Simon McVittie <smcv@debian.org> Fri, 10 May 2024 11:07:44 +0100 + glib2.0 (2.80.1-1) unstable; urgency=medium * New upstream stable release @@ -23,10 +59,6 @@ glib2.0 (2.80.0-10) unstable; urgency=high - If local users send signals on the D-Bus system bus that spoof a trusted sender, do not deliver them to signal subscriptions for the trusted sender's well-known bus name (CVE-2024-34397) - - Fix a use-after-free when subscribing to signals with an arg0 - match rule, originally from 2.79.0 and necessary to make the test - for CVE-2024-34397 pass reliably - - Add a local backport of g_set_str(), required by the above - Add proposed fix for a race condition that can cause a unit test to regress after the above * d/control: Add Breaks on gnome-shell (<< 44.9-2~). diff --git a/debian/control b/debian/control index 3c19ebbc0..8ab8382aa 100644 --- a/debian/control +++ b/debian/control @@ -164,8 +164,8 @@ Description: Development files for the GLib library as only it includes the header files and static libraries (optionally) needed for compiling. . - GObject-Introspection metadata for this library can be found in the - libgirepository1.0-dev package. + GObject-Introspection metadata for this library is not included here, and + can be found in the gir1.2-glib-2.0-dev package. Package: libglib2.0-dev-bin Section: libdevel @@ -231,7 +231,8 @@ Package: libgirepository-2.0-dev Section: libdevel Architecture: any Multi-Arch: same -Depends: libglib2.0-dev (= ${binary:Version}), +Depends: libgirepository-2.0-0 (= ${binary:Version}), + libglib2.0-dev (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: Development files for the GObject introspection library @@ -240,6 +241,9 @@ Description: Development files for the GObject introspection library C library used by projects such as GTK+, GIMP, and GNOME. . This package is needed to compile programs against libgirepository-2.0-0. + . + GObject-Introspection metadata for this library is not included here, and + can be found in the gir1.2-girepository-3.0-dev package. Package: gir1.2-glib-2.0 Build-Profiles: <!nogir> diff --git a/debian/libglib2.0-doc.doc-base.gvariant-specification b/debian/libglib2.0-doc.doc-base.gvariant-specification index 3c4bbbada..e5ac60eb4 100644 --- a/debian/libglib2.0-doc.doc-base.gvariant-specification +++ b/debian/libglib2.0-doc.doc-base.gvariant-specification @@ -11,5 +11,5 @@ Abstract: Section: Programming Format: HTML -Index: /usr/share/doc/libglib2.0-dev/gvariant-specification-1.0.html -Files: /usr/share/doc/libglib2.0-dev/gvariant-*.html /usr/share/doc/libglib2.0-dev/gvariant-*.svg +Index: /usr/share/doc/libglib2.0-dev/glib-2.0/gvariant-specification-1.0.html +Files: /usr/share/doc/libglib2.0-dev/glib-2.0/gvariant-specification-1.0.html /usr/share/doc/libglib2.0-dev/glib-2.0/gvariant-*.svg diff --git a/debian/libglib2.0-doc.docs b/debian/libglib2.0-doc.docs index 07da08702..5f29e69bd 100644 --- a/debian/libglib2.0-doc.docs +++ b/debian/libglib2.0-doc.docs @@ -1,3 +1 @@ usr/share/doc/*-2.0/ -usr/share/doc/gvariant-*.html -usr/share/doc/gvariant-*.svg diff --git a/debian/libglib2.0-doc.links b/debian/libglib2.0-doc.links index 30d048bc8..33dd4ab3b 100644 --- a/debian/libglib2.0-doc.links +++ b/debian/libglib2.0-doc.links @@ -12,4 +12,3 @@ usr/share/doc/libglib2.0-dev/gmodule-2.0 usr/share/devhelp/books/gmodule- usr/share/doc/libglib2.0-dev/gmodule-2.0 usr/share/doc/libglib2.0-doc/gmodule-2.0 usr/share/doc/libglib2.0-dev/gobject-2.0 usr/share/devhelp/books/gobject-2.0 usr/share/doc/libglib2.0-dev/gobject-2.0 usr/share/doc/libglib2.0-doc/gobject-2.0 -usr/share/doc/libglib2.0-dev/gvariant-specification-1.0.html usr/share/doc/libglib2.0-doc/gvariant-specification-1.0.html diff --git a/debian/patches/gactiongroupexporter-Fix-memory-problems-on-an-error-hand.patch b/debian/patches/gactiongroupexporter-Fix-memory-problems-on-an-error-hand.patch new file mode 100644 index 000000000..2aa6cb873 --- /dev/null +++ b/debian/patches/gactiongroupexporter-Fix-memory-problems-on-an-error-hand.patch @@ -0,0 +1,142 @@ +From: Philip Withnall <pwithnall@gnome.org> +Date: Wed, 15 May 2024 14:00:09 +0100 +Subject: gactiongroupexporter: Fix memory problems on an error handling path + +Almost identically to the previous commit, fix a similar latent bug in +`g_dbus_connection_export_action_group()`, which was not ready to handle +the fledgling `GActionGroupExporter` being freed early on an error +handling path. + +See the previous commit message for details of the approach. + +This includes a unit test. + +Signed-off-by: Philip Withnall <pwithnall@gnome.org> +Origin: upstream, 2.80.3, commit:043a06debb7a00530caa6194bf1b14b02200fae7 +Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/3366 +Bug-Debian: https://bugs.debian.org/1071690 +--- + gio/gactiongroupexporter.c | 35 +++++++++++++++-------------------- + gio/tests/actions.c | 41 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 56 insertions(+), 20 deletions(-) + +diff --git a/gio/gactiongroupexporter.c b/gio/gactiongroupexporter.c +index 3ec1db2..1e253ec 100644 +--- a/gio/gactiongroupexporter.c ++++ b/gio/gactiongroupexporter.c +@@ -531,10 +531,8 @@ org_gtk_Actions_method_call (GDBusConnection *connection, + } + + static void +-g_action_group_exporter_free (gpointer user_data) ++g_action_group_exporter_free (GActionGroupExporter *exporter) + { +- GActionGroupExporter *exporter = user_data; +- + g_signal_handlers_disconnect_by_func (exporter->action_group, + g_action_group_exporter_action_added, exporter); + g_signal_handlers_disconnect_by_func (exporter->action_group, +@@ -616,15 +614,6 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, + } + + exporter = g_slice_new (GActionGroupExporter); +- id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, +- exporter, g_action_group_exporter_free, error); +- +- if (id == 0) +- { +- g_slice_free (GActionGroupExporter, exporter); +- return 0; +- } +- + exporter->context = g_main_context_ref_thread_default (); + exporter->pending_changes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + exporter->pending_source = NULL; +@@ -632,14 +621,20 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, + exporter->connection = g_object_ref (connection); + exporter->object_path = g_strdup (object_path); + +- g_signal_connect (action_group, "action-added", +- G_CALLBACK (g_action_group_exporter_action_added), exporter); +- g_signal_connect (action_group, "action-removed", +- G_CALLBACK (g_action_group_exporter_action_removed), exporter); +- g_signal_connect (action_group, "action-state-changed", +- G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); +- g_signal_connect (action_group, "action-enabled-changed", +- G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); ++ id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, ++ exporter, (GDestroyNotify) g_action_group_exporter_free, error); ++ ++ if (id != 0) ++ { ++ g_signal_connect (action_group, "action-added", ++ G_CALLBACK (g_action_group_exporter_action_added), exporter); ++ g_signal_connect (action_group, "action-removed", ++ G_CALLBACK (g_action_group_exporter_action_removed), exporter); ++ g_signal_connect (action_group, "action-state-changed", ++ G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); ++ g_signal_connect (action_group, "action-enabled-changed", ++ G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); ++ } + + return id; + } +diff --git a/gio/tests/actions.c b/gio/tests/actions.c +index a24c52c..2b7a100 100644 +--- a/gio/tests/actions.c ++++ b/gio/tests/actions.c +@@ -1125,6 +1125,46 @@ test_dbus_export (void) + session_bus_down (); + } + ++static void ++test_dbus_export_error_handling (void) ++{ ++ GDBusConnection *bus = NULL; ++ GSimpleActionGroup *group = NULL; ++ GError *local_error = NULL; ++ guint id1, id2; ++ ++ g_test_summary ("Test that error handling of action group export failure works"); ++ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); ++ ++ session_bus_up (); ++ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); ++ ++ group = g_simple_action_group_new (); ++ g_simple_action_group_add_entries (group, ++ exported_entries, ++ G_N_ELEMENTS (exported_entries), ++ NULL); ++ ++ id1 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); ++ g_assert_no_error (local_error); ++ g_assert_cmpuint (id1, !=, 0); ++ ++ /* Trigger a failure by trying to export on a path which is already in use */ ++ id2 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); ++ g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); ++ g_assert_cmpuint (id2, ==, 0); ++ g_clear_error (&local_error); ++ ++ g_dbus_connection_unexport_action_group (bus, id1); ++ ++ while (g_main_context_iteration (NULL, FALSE)); ++ ++ g_object_unref (group); ++ g_object_unref (bus); ++ ++ session_bus_down (); ++} ++ + static gpointer + do_export (gpointer data) + { +@@ -1448,6 +1488,7 @@ main (int argc, char **argv) + g_test_add_func ("/actions/entries", test_entries); + g_test_add_func ("/actions/parse-detailed", test_parse_detailed); + g_test_add_func ("/actions/dbus/export", test_dbus_export); ++ g_test_add_func ("/actions/dbus/export/error-handling", test_dbus_export_error_handling); + g_test_add_func ("/actions/dbus/threaded", test_dbus_threaded); + g_test_add_func ("/actions/dbus/bug679509", test_bug679509); + g_test_add_func ("/actions/property", test_property_actions); diff --git a/debian/patches/gdbusconnection-Allow-name-owners-to-have-the-syntax-of-a.patch b/debian/patches/gdbusconnection-Allow-name-owners-to-have-the-syntax-of-a.patch deleted file mode 100644 index b567cc01b..000000000 --- a/debian/patches/gdbusconnection-Allow-name-owners-to-have-the-syntax-of-a.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: Simon McVittie <smcv@debian.org> -Date: Wed, 8 May 2024 10:09:40 +0100 -Subject: gdbusconnection: Allow name owners to have the syntax of a - well-known name - -In a D-Bus-Specification-compliant message bus, the owner of a well-known -name is a unique name. However, ibus has its own small implementation -of a message bus (src/ibusbus.c) in which org.freedesktop.IBus is -special-cased to also have itself as its owner (like org.freedesktop.DBus -on a standard message bus), and connects to that bus with the -G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flag. The ability to do -this regressed when CVE-2024-34397 was fixed. - -Relax the checks to allow the owner of a well-known name to be any valid -D-Bus name, even if it is not syntactically a unique name. - -Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/3353 -Bug-Debian: https://bugs.debian.org/1070730 -Bug-Debian: https://bugs.debian.org/1070736 -Bug-Debian: https://bugs.debian.org/1070743 -Bug-Debian: https://bugs.debian.org/1070745 -Signed-off-by: Simon McVittie <smcv@debian.org> -Forwarded: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4053 ---- - gio/gdbusconnection.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c -index a543df9..9584447 100644 ---- a/gio/gdbusconnection.c -+++ b/gio/gdbusconnection.c -@@ -2380,7 +2380,7 @@ name_watcher_deliver_name_owner_changed_unlocked (SignalData *name_watcher, - /* Our caller already checked this */ - g_assert (g_strcmp0 (name_watcher->arg0, name) == 0); - -- if (G_LIKELY (new_owner[0] == '\0' || g_dbus_is_unique_name (new_owner))) -+ if (G_LIKELY (new_owner[0] == '\0' || g_dbus_is_name (new_owner))) - name_watcher_set_name_owner_unlocked (name_watcher, new_owner); - else - g_warning ("Received NameOwnerChanged signal with invalid owner \"%s\" for \"%s\"", -@@ -2432,7 +2432,7 @@ name_watcher_deliver_get_name_owner_reply_unlocked (SignalData *name_watcher, - - g_variant_get (body, "(&s)", &new_owner); - -- if (G_LIKELY (g_dbus_is_unique_name (new_owner))) -+ if (G_LIKELY (g_dbus_is_name (new_owner))) - name_watcher_set_name_owner_unlocked (name_watcher, new_owner); - else - g_warning ("Received GetNameOwner reply with invalid owner \"%s\" for \"%s\"", diff --git a/debian/patches/gdbusconnection-Fix-test-signal-subscription-ordering.patch b/debian/patches/gdbusconnection-Fix-test-signal-subscription-ordering.patch deleted file mode 100644 index 742aeda16..000000000 --- a/debian/patches/gdbusconnection-Fix-test-signal-subscription-ordering.patch +++ /dev/null @@ -1,101 +0,0 @@ -From: Ray Strode <rstrode@redhat.com> -Date: Tue, 7 May 2024 15:31:47 -0400 -Subject: gdbusconnection: Fix test signal subscription ordering - -The test case assumes signals will dispatched in a different order than -they're subscribed. In fact, signals can be dispatched in any order, -and are often dispatched in order. - -This commit reorders the subscriptions so they're in order, which is -more logical, and also changes the code to only exit the event loops -when there are no pending handlers ready to dispatch. - -Origin: upstream, 2.81.0, commit:47866d252f5094b0a3466ac5fb52fc46ea44a228 ---- - gio/tests/gdbus-connection.c | 29 +++++++++++++++++------------ - 1 file changed, 17 insertions(+), 12 deletions(-) - -diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c -index 95d2b84..fc88167 100644 ---- a/gio/tests/gdbus-connection.c -+++ b/gio/tests/gdbus-connection.c -@@ -536,7 +536,12 @@ test_connection_signal_handler (GDBusConnection *connection, - interface_name, - signal_name);*/ - -- g_main_loop_quit (loop); -+ /* We defer quitting to a G_PRIORITY_DEFAULT_IDLE function so other queued signal -+ * callbacks have a chance to run first. They get dispatched with a higher priority -+ * of G_PIORITY_DEFAULT, so as long as the queue is non-empty g_main_loop_quit won't -+ * run -+ */ -+ g_idle_add_once ((GSourceOnceFunc) g_main_loop_quit, loop); - } - - static void -@@ -627,7 +632,7 @@ test_connection_signals (void) - "org.gtk.GDBus.ExampleInterface", /* interface */ - "FooArg0", /* member */ - "/org/gtk/GDBus/ExampleInterface", /* path */ -- "some-arg0", -+ NULL, - G_DBUS_SIGNAL_FLAGS_NONE, - test_connection_signal_handler, - &count_s4, -@@ -637,7 +642,7 @@ test_connection_signals (void) - "org.gtk.GDBus.ExampleInterface", /* interface */ - "FooArg0", /* member */ - "/org/gtk/GDBus/ExampleInterface", /* path */ -- NULL, -+ "some-arg0", - G_DBUS_SIGNAL_FLAGS_NONE, - test_connection_signal_handler, - &count_s5, -@@ -741,8 +746,8 @@ test_connection_signals (void) - g_assert_cmpint (count_s2, ==, 2); - - /* Emit another signal on c2 with and without arg0 set, to check matching on that. -- * Matching should fail on s4 when the signal is not emitted with an arg0. It -- * should succeed on s5 both times, as that doesn’t require an arg0 match. */ -+ * Matching should fail on s5 when the signal is not emitted with an arg0. It -+ * should succeed on s4 both times, as that doesn’t require an arg0 match. */ - ret = g_dbus_connection_emit_signal (c2, - NULL, /* destination bus name */ - "/org/gtk/GDBus/ExampleInterface", -@@ -753,9 +758,9 @@ test_connection_signals (void) - g_assert_no_error (error); - g_assert_true (ret); - -- while (count_s5 < 1) -+ while (count_s4 < 1) - g_main_loop_run (loop); -- g_assert_cmpint (count_s5, ==, 1); -+ g_assert_cmpint (count_s4, ==, 1); - - ret = g_dbus_connection_emit_signal (c2, - NULL, /* destination bus name */ -@@ -767,10 +772,10 @@ test_connection_signals (void) - g_assert_no_error (error); - g_assert_true (ret); - -- while (count_s4 < 1) -+ while (count_s5 < 1) - g_main_loop_run (loop); -- g_assert_cmpint (count_s4, ==, 1); -- g_assert_cmpint (count_s5, ==, 2); -+ g_assert_cmpint (count_s4, ==, 2); -+ g_assert_cmpint (count_s5, ==, 1); - - /* - * Also to check the total amount of NameOwnerChanged signals - use a 5 second ceiling -@@ -784,8 +789,8 @@ test_connection_signals (void) - g_assert_cmpint (count_s1, ==, 1); - g_assert_cmpint (count_s2, ==, 2); - g_assert_cmpint (count_name_owner_changed, ==, 2); -- g_assert_cmpint (count_s4, ==, 1); -- g_assert_cmpint (count_s5, ==, 2); -+ g_assert_cmpint (count_s4, ==, 2); -+ g_assert_cmpint (count_s5, ==, 1); - - g_dbus_connection_signal_unsubscribe (c1, s1); - g_dbus_connection_signal_unsubscribe (c1, s2); diff --git a/debian/patches/gdbusmessage-Clean-the-cached-arg0-when-setting-the-messa.patch b/debian/patches/gdbusmessage-Clean-the-cached-arg0-when-setting-the-messa.patch new file mode 100644 index 000000000..5b3d904ef --- /dev/null +++ b/debian/patches/gdbusmessage-Clean-the-cached-arg0-when-setting-the-messa.patch @@ -0,0 +1,40 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 22:53:51 +0200 +Subject: gdbusmessage: Clean the cached arg0 when setting the message body + +We're now caching arg0 but such value is not cleared when a new body is +set as it's in the connection filter test cases where we've a leak as +highlighted by both valgrind and leak sanitizer + +Origin: upstream, 2.80.3, commit:fe89e9f3cb6e0fd0dc2bd8a2d413799e1443cef1 +--- + gio/gdbusmessage.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c +index 5a5fec8..b7074f7 100644 +--- a/gio/gdbusmessage.c ++++ b/gio/gdbusmessage.c +@@ -1155,10 +1155,12 @@ g_dbus_message_set_body (GDBusMessage *message, + + if (message->body != NULL) + g_variant_unref (message->body); ++ ++ g_clear_pointer (&message->arg0_cache, g_variant_unref); ++ + if (body == NULL) + { + message->body = NULL; +- message->arg0_cache = NULL; + g_dbus_message_set_signature (message, NULL); + } + else +@@ -1172,8 +1174,6 @@ g_dbus_message_set_body (GDBusMessage *message, + if (g_variant_is_of_type (message->body, G_VARIANT_TYPE_TUPLE) && + g_variant_n_children (message->body) > 0) + message->arg0_cache = g_variant_get_child_value (message->body, 0); +- else +- message->arg0_cache = NULL; + + type_string = g_variant_get_type_string (body); + type_string_len = strlen (type_string); diff --git a/debian/patches/gio-tests-gsettings-Cleanup-allocated-new-locales.patch b/debian/patches/gio-tests-gsettings-Cleanup-allocated-new-locales.patch new file mode 100644 index 000000000..21bd2354d --- /dev/null +++ b/debian/patches/gio-tests-gsettings-Cleanup-allocated-new-locales.patch @@ -0,0 +1,39 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 23:02:39 +0200 +Subject: gio/tests/gsettings: Cleanup allocated new locales + +Origin: upstream, 2.80.3, commit:e4d369d5f4defe54ef55954685b3275bcec0a2a3 +--- + gio/tests/gsettings.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c +index 6995fee..b12d259 100644 +--- a/gio/tests/gsettings.c ++++ b/gio/tests/gsettings.c +@@ -924,6 +924,8 @@ test_l10n_time (void) + g_assert_true (original_locale != (locale_t) 0); + new_locale = duplocale (original_locale); + g_assert_true (new_locale != (locale_t) 0); ++ g_clear_pointer (&new_locale, freelocale); ++ + new_locale = newlocale (LC_TIME_MASK, "C", new_locale); + g_assert_true (new_locale != (locale_t) 0); + result = uselocale (new_locale); +@@ -936,6 +938,7 @@ test_l10n_time (void) + + g_assert_cmpstr (str, ==, "12:00 AM"); + g_free (str); ++ g_clear_pointer (&new_locale, freelocale); + str = NULL; + + new_locale = newlocale (LC_TIME_MASK, "de_DE.UTF-8", new_locale); +@@ -964,7 +967,7 @@ test_l10n_time (void) + + result = uselocale (original_locale); + g_assert_true (result == new_locale); +- freelocale (new_locale); ++ g_clear_pointer (&new_locale, freelocale); + + g_object_unref (settings); + #endif diff --git a/debian/patches/girepository-Don-t-assume-a-bitfield-has-a-fixed-size.patch b/debian/patches/girepository-Don-t-assume-a-bitfield-has-a-fixed-size.patch new file mode 100644 index 000000000..c12e1f252 --- /dev/null +++ b/debian/patches/girepository-Don-t-assume-a-bitfield-has-a-fixed-size.patch @@ -0,0 +1,41 @@ +From: Adam Sampson <ats@offog.org> +Date: Fri, 10 May 2024 18:37:52 +0100 +Subject: girepository: Don't assume a bitfield has a fixed size + +The type used when declaring a bitfield member of a struct doesn't +affect the amount of space allocated for it - only whether it's signed +or unsigned. In standard C99 (6.2.7.1), only _Bool, signed int and +unsigned int or typedefs to them are allowed as bitfield types, but GCC +allows other integer types as an extension. + +In this case, the GIBaseInfo and GIBaseInfoStack structs are meant to +have identical layout. However, type_is_embedded was declared as an +unsigned bitfield in the former and a uint32_t in the latter. This was +harmless on most platforms because the following member is an aligned +pointer, but (for example) on m68k-linux-gnu pointers only need to be +16-bit aligned, so GCC only allocates 16 bits for the bitfield. + +Change the type in the declaration to unsigned int, and add an padding +bitfield following it to ensure there's space for 32 bits on all +platforms in the future. + +Signed-off-by: Adam Sampson <ats@offog.org> +Origin: upstream, 2.80.3, commit:62b11360daddc73ca1deb1a143f614c101858dce +--- + girepository/girepository-private.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h +index 8ff3123..29156c5 100644 +--- a/girepository/girepository-private.h ++++ b/girepository/girepository-private.h +@@ -57,7 +57,8 @@ struct _GIBaseInfo + GITypelib *typelib; + uint32_t offset; + +- uint32_t type_is_embedded : 1; /* Used by GITypeInfo */ ++ unsigned int type_is_embedded : 1; /* Used by GITypeInfo */ ++ unsigned int padding_bitfield : 31; /* For future expansion */ + + /* A copy of GIBaseInfo is exposed publicly for stack-allocated derivatives + * such as GITypeInfo, so its size is now ABI. */ diff --git a/debian/patches/girepository-introspection-Properly-check-for-sanitizer-v.patch b/debian/patches/girepository-introspection-Properly-check-for-sanitizer-v.patch new file mode 100644 index 000000000..f80f37dd2 --- /dev/null +++ b/debian/patches/girepository-introspection-Properly-check-for-sanitizer-v.patch @@ -0,0 +1,24 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Thu, 9 May 2024 17:47:04 +0200 +Subject: girepository/introspection: Properly check for sanitizer value + +The sanitizer option is set to 'none' when not used + +Origin: upstream, 2.80.3, commit:5fc08f60b57e01b11c2a4d707121d8cd38979f07 +--- + girepository/introspection/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/girepository/introspection/meson.build b/girepository/introspection/meson.build +index 9405686..b23d048 100644 +--- a/girepository/introspection/meson.build ++++ b/girepository/introspection/meson.build +@@ -9,7 +9,7 @@ gi_gen_shared_sources = [ + + gi_gen_env_variables = environment() + +-if get_option('b_sanitize') != '' ++if get_option('b_sanitize') != 'none' + gi_gen_env_variables.append( + 'ASAN_OPTIONS', 'verify_asan_link_order=0', separator: ',') + endif diff --git a/debian/patches/girrepository-tests-Add-full-gir-dependencies-on-tests.patch b/debian/patches/girrepository-tests-Add-full-gir-dependencies-on-tests.patch new file mode 100644 index 000000000..624e92a22 --- /dev/null +++ b/debian/patches/girrepository-tests-Add-full-gir-dependencies-on-tests.patch @@ -0,0 +1,93 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 23:11:30 +0200 +Subject: girrepository/tests: Add full gir dependencies on tests + +Tests may have runtime dependencies that are related to the typelib +dependencies, so we need to satify them or the tests will fail at +runtime if we're not building their prerequisite for other reasons. + +That's saying that the tests are currently failing when explicitly +running as standalone in meson. + +Co-Authored-By: Philip Withnall <philip@tecnocode.co.uk> +Origin: upstream, 2.80.3, commit:b48b7b2a84709cb43fb796e0e365572dac22e13e +--- + girepository/tests/meson.build | 40 +++++++++++++++++++++++++++++++--------- + 1 file changed, 31 insertions(+), 9 deletions(-) + +diff --git a/girepository/tests/meson.build b/girepository/tests/meson.build +index 7f5b709..a8e5b3d 100644 +--- a/girepository/tests/meson.build ++++ b/girepository/tests/meson.build +@@ -12,32 +12,54 @@ girepository_tests = { + + # Some tests require GIR files to have been generated + if enable_gir ++ glib_gir_testing_dep = glib_gir ++ gobject_gir_testing_dep = [ ++ glib_gir_testing_dep, ++ gobject_gir, ++ ] ++ ++ gmodule_gir_testing_dep = [ ++ glib_gir_testing_dep, ++ gmodule_gir, ++ ] ++ ++ gio_gir_testing_dep = [ ++ gobject_gir_testing_dep, ++ gmodule_gir_testing_dep, ++ gio_gir, ++ ] ++ ++ girepository_gir_testing_dep = [ ++ gio_gir_testing_dep, ++ girepository_gir, ++ ] ++ + girepository_tests += { + 'function-info' : { + 'dependencies': [libffi_dep], +- 'depends': [glib_gir], ++ 'depends': glib_gir_testing_dep, + }, + 'object-info' : { +- 'depends': [gio_gir], ++ 'depends': gio_gir_testing_dep, + }, + 'registered-type-info' : { +- 'depends': [gobject_gir], ++ 'depends': gobject_gir_testing_dep, + }, + 'repository' : { +- 'depends': [glib_gir, gio_gir, gobject_gir], ++ 'depends': gio_gir_testing_dep, + }, + 'repository-search-paths' : { + 'c_args': '-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir), +- 'depends': [glib_gir], ++ 'depends': glib_gir_testing_dep, + }, + 'struct-info' : { +- 'depends': [gobject_gir], ++ 'depends': gobject_gir_testing_dep, + }, + 'throws' : { +- 'depends': [glib_gir, gio_gir], ++ 'depends': gio_gir_testing_dep, + }, + 'union-info' : { +- 'depends': [glib_gir], ++ 'depends': glib_gir_testing_dep, + }, + } + +@@ -45,7 +67,7 @@ if enable_gir + girepository_tests += { + 'autoptr-girepository' : { + 'source' : 'autoptr.c', +- 'depends': [glib_gir, gio_gir], ++ 'depends': gio_gir_testing_dep, + }, + } + endif diff --git a/debian/patches/glib-tests-constructor-Add-test-dependency-on-constructor.patch b/debian/patches/glib-tests-constructor-Add-test-dependency-on-constructor.patch new file mode 100644 index 000000000..b58edfcc5 --- /dev/null +++ b/debian/patches/glib-tests-constructor-Add-test-dependency-on-constructor.patch @@ -0,0 +1,23 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 23:10:19 +0200 +Subject: glib/tests/constructor: Add test dependency on constructor_lib + +Otherwise we may build the test but not its dependent library + +Origin: upstream, 2.80.3, commit:a5ec1dd612a25742f2a363f10d57fb03091cfdab +--- + glib/tests/meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/glib/tests/meson.build b/glib/tests/meson.build +index 85f40d2..92486cf 100644 +--- a/glib/tests/meson.build ++++ b/glib/tests/meson.build +@@ -350,6 +350,7 @@ if host_machine.system() == 'windows' or have_dlopen_dlsym + '-DBUILD_TEST_EXECUTABLE', + '-DPREFIX=app'], + 'dependencies' : libdl_dep, ++ 'depends': constructor_lib, + 'link_with': [constructor_helper] + } + } diff --git a/debian/patches/glib-tests-gutils-user-database-Add-test-dependency-on-pr.patch b/debian/patches/glib-tests-gutils-user-database-Add-test-dependency-on-pr.patch new file mode 100644 index 000000000..8e6ae65de --- /dev/null +++ b/debian/patches/glib-tests-gutils-user-database-Add-test-dependency-on-pr.patch @@ -0,0 +1,26 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Thu, 9 May 2024 16:59:57 +0200 +Subject: glib/tests/gutils-user-database: Add test dependency on preload + library + +We do preload the library but that's not set as test dependency and so +it may not be built + +Origin: upstream, 2.80.3, commit:c6770f964c8489b7bec42ecf8be7a2175f821ca0 +--- + glib/tests/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/glib/tests/meson.build b/glib/tests/meson.build +index 92486cf..c448b81 100644 +--- a/glib/tests/meson.build ++++ b/glib/tests/meson.build +@@ -263,7 +263,7 @@ else + + glib_tests += { + 'gutils-user-database' : { +- 'depends' : [], ++ 'depends' : getpwuid_preload, + 'env' : { + var_preload: getpwuid_preload.full_path() + }, diff --git a/debian/patches/glib-tests-mapping-Check-the-exit-status-of-the-child-pro.patch b/debian/patches/glib-tests-mapping-Check-the-exit-status-of-the-child-pro.patch new file mode 100644 index 000000000..6e902fdbf --- /dev/null +++ b/debian/patches/glib-tests-mapping-Check-the-exit-status-of-the-child-pro.patch @@ -0,0 +1,62 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Fri, 10 May 2024 01:17:15 +0200 +Subject: glib/tests/mapping: Check the exit status of the child process + +In this way if it fails for some memory error we can track it + +Origin: upstream, 2.80.3, commit:116312f089a2142fc8a20353543d805f01085458 +--- + glib/tests/mapping.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/glib/tests/mapping.c b/glib/tests/mapping.c +index 99cb8ee..5fcde83 100644 +--- a/glib/tests/mapping.c ++++ b/glib/tests/mapping.c +@@ -22,6 +22,7 @@ + + #ifdef G_OS_UNIX + #include <unistd.h> ++#include <sys/wait.h> + #endif + #ifdef G_OS_WIN32 + #include <process.h> +@@ -201,8 +202,10 @@ test_child_private (void) + gsize len; + gchar *child_argv[4]; + GPid child_pid; ++ GSpawnFlags spawn_flags = G_SPAWN_DEFAULT; + #ifndef G_OS_WIN32 + GMainLoop *loop; ++ int wait_status; + #endif + gchar pid[100]; + gchar *dir, *global_filename, *childname; +@@ -221,6 +224,7 @@ test_child_private (void) + + #ifndef G_OS_WIN32 + signal (SIGUSR1, handle_usr1); ++ spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD; + #endif + + g_snprintf (pid, sizeof(pid), "%d", getpid ()); +@@ -230,7 +234,7 @@ test_child_private (void) + child_argv[3] = NULL; + + result = g_spawn_async (dir, child_argv, NULL, +- 0, NULL, NULL, &child_pid, &error); ++ spawn_flags, NULL, NULL, &child_pid, &error); + g_assert_no_error (error); + g_assert_true (result); + g_test_message ("test_child_private: child spawned"); +@@ -261,6 +265,10 @@ test_child_private (void) + #ifndef G_OS_WIN32 + g_idle_add (check_stop, loop); + g_main_loop_run (loop); ++ waitpid (child_pid, &wait_status, 0); ++ g_test_message ("Child exited with status %d", wait_status); ++ g_spawn_check_wait_status (wait_status, &error); ++ g_assert_no_error (error); + #else + g_usleep (2000000); + #endif diff --git a/debian/patches/glib-tests-mapping-Unref-the-mapped-file-on-exit.patch b/debian/patches/glib-tests-mapping-Unref-the-mapped-file-on-exit.patch new file mode 100644 index 000000000..476906af4 --- /dev/null +++ b/debian/patches/glib-tests-mapping-Unref-the-mapped-file-on-exit.patch @@ -0,0 +1,21 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Fri, 10 May 2024 01:17:41 +0200 +Subject: glib/tests/mapping: Unref the mapped file on exit + +Origin: upstream, 2.80.3, commit:9c611f6ef94fce218172c2f22b40d34b6bdbed1d +--- + glib/tests/mapping.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/glib/tests/mapping.c b/glib/tests/mapping.c +index 5fcde83..bbd4de8 100644 +--- a/glib/tests/mapping.c ++++ b/glib/tests/mapping.c +@@ -125,6 +125,7 @@ child_main (void) + g_free (childname); + g_free (global_filename); + g_free (dir); ++ g_mapped_file_unref (map); + + signal_parent (NULL); + } diff --git a/debian/patches/glib-tests-unicode-Cleanup-allocated-old-locale-if-tests-.patch b/debian/patches/glib-tests-unicode-Cleanup-allocated-old-locale-if-tests-.patch new file mode 100644 index 000000000..33d71b2cf --- /dev/null +++ b/debian/patches/glib-tests-unicode-Cleanup-allocated-old-locale-if-tests-.patch @@ -0,0 +1,21 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 23:03:03 +0200 +Subject: glib/tests/unicode: Cleanup allocated old locale if tests is skipped + +Origin: upstream, 2.80.3, commit:a2111bec6956d22b2113599c62c174e89c37685e +--- + glib/tests/unicode.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c +index e91425a..cb74068 100644 +--- a/glib/tests/unicode.c ++++ b/glib/tests/unicode.c +@@ -525,6 +525,7 @@ test_turkish_strupdown (void) + if (oldlocale == NULL) + { + g_test_skip ("locale tr_TR not available"); ++ g_free (old_lang); + return; + } + diff --git a/debian/patches/glocalfile-Trash-free-values-when-done-avoiding-leaks-on-.patch b/debian/patches/glocalfile-Trash-free-values-when-done-avoiding-leaks-on-.patch new file mode 100644 index 000000000..d2828a80c --- /dev/null +++ b/debian/patches/glocalfile-Trash-free-values-when-done-avoiding-leaks-on-.patch @@ -0,0 +1,53 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Wed, 8 May 2024 22:59:44 +0200 +Subject: glocalfile: Trash, + free values when done avoiding leaks on early returns + +In glocalfile we're allocating some temporary strings but we don't free +them on early returns, so free them once done and unset the variables +to prevent them being used incorrectly. + +Origin: upstream, 2.80.3, commit:5201650b2174730c54927bca781becf73315bac1 +--- + gio/glocalfile.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/gio/glocalfile.c b/gio/glocalfile.c +index ceb888a..56ee5e5 100644 +--- a/gio/glocalfile.c ++++ b/gio/glocalfile.c +@@ -2284,6 +2284,7 @@ g_local_file_trash (GFile *file, + data = g_strdup_printf ("[Trash Info]\nPath=%s\nDeletionDate=%s\n", + original_name_escaped, delete_time); + g_free (delete_time); ++ g_clear_pointer (&original_name_escaped, g_free); + + if (!g_file_set_contents_full (infofile, data, -1, + G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING, +@@ -2291,6 +2292,7 @@ g_local_file_trash (GFile *file, + { + g_unlink (infofile); + ++ g_free (data); + g_free (filesdir); + g_free (trashname); + g_free (infofile); +@@ -2298,6 +2300,8 @@ g_local_file_trash (GFile *file, + return FALSE; + } + ++ g_clear_pointer (&data, g_free); ++ + /* TODO: Maybe we should verify that you can delete the file from the trash + * before moving it? OTOH, that is hard, as it needs a recursive scan + */ +@@ -2341,9 +2345,6 @@ g_local_file_trash (GFile *file, + /* TODO: Do we need to update mtime/atime here after the move? */ + + g_free (infofile); +- g_free (data); +- +- g_free (original_name_escaped); + g_free (trashname); + + return TRUE; diff --git a/debian/patches/gmenuexporter-Fix-a-NULL-pointer-dereference-on-an-error-.patch b/debian/patches/gmenuexporter-Fix-a-NULL-pointer-dereference-on-an-error-.patch new file mode 100644 index 000000000..8151eef47 --- /dev/null +++ b/debian/patches/gmenuexporter-Fix-a-NULL-pointer-dereference-on-an-error-.patch @@ -0,0 +1,140 @@ +From: Philip Withnall <pwithnall@gnome.org> +Date: Wed, 15 May 2024 12:26:36 +0100 +Subject: gmenuexporter: Fix a NULL pointer dereference on an error handling + path +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +This latent bug wasn’t triggered until commit 3f30ec86c (or its +cherry-pick onto `glib-2-80`, 747e3af99, which was first released in +2.80.1). + +That change means that `g_menu_exporter_free()` is now called on the +registration failure path by `g_dbus_connection_register_object()` +before it returns. The caller then tries to call `g_slice_free()` on the +exporter again. The call to `g_menu_exporter_free()` tries to +dereference/free members of the exporter which it expects to be +initialised — but because this is happening in an error handling path, +they are not initialised. + +If it were to get any further, the `g_slice_free()` would then be a +double-free on the exporter allocation. + +Fix that by making `g_menu_exporter_free()` robust to some of the +exporter members being `NULL`, and moving some of the initialisation +code higher in `g_dbus_connection_export_menu_model()`, and removing the +duplicate free code on the error handling path. + +This includes a unit test. + +Signed-off-by: Philip Withnall <pwithnall@gnome.org> +Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/3366 +Origin: upstream, 2.80.3, commit:5f5667b2a0ae2cdf6d39f51afbc2bdca1947dfaf +Bug-Debian: https://bugs.debian.org/1071690 +--- + gio/gmenuexporter.c | 23 ++++++++--------------- + gio/tests/gmenumodel.c | 37 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+), 15 deletions(-) + +diff --git a/gio/gmenuexporter.c b/gio/gmenuexporter.c +index 909780c..1d4db13 100644 +--- a/gio/gmenuexporter.c ++++ b/gio/gmenuexporter.c +@@ -707,11 +707,9 @@ g_menu_exporter_create_group (GMenuExporter *exporter) + } + + static void +-g_menu_exporter_free (gpointer user_data) ++g_menu_exporter_free (GMenuExporter *exporter) + { +- GMenuExporter *exporter = user_data; +- +- g_menu_exporter_menu_free (exporter->root); ++ g_clear_pointer (&exporter->root, g_menu_exporter_menu_free); + g_clear_pointer (&exporter->peer_remote, g_menu_exporter_remote_free); + g_hash_table_unref (exporter->remotes); + g_hash_table_unref (exporter->groups); +@@ -794,21 +792,16 @@ g_dbus_connection_export_menu_model (GDBusConnection *connection, + guint id; + + exporter = g_slice_new0 (GMenuExporter); +- +- id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), +- &vtable, exporter, g_menu_exporter_free, error); +- +- if (id == 0) +- { +- g_slice_free (GMenuExporter, exporter); +- return 0; +- } +- + exporter->connection = g_object_ref (connection); + exporter->object_path = g_strdup (object_path); + exporter->groups = g_hash_table_new (NULL, NULL); + exporter->remotes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_menu_exporter_remote_free); +- exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); ++ ++ id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), ++ &vtable, exporter, (GDestroyNotify) g_menu_exporter_free, error); ++ ++ if (id != 0) ++ exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); + + return id; + } +diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c +index d75f36a..22d1b4d 100644 +--- a/gio/tests/gmenumodel.c ++++ b/gio/tests/gmenumodel.c +@@ -1159,6 +1159,42 @@ test_dbus_peer_subscriptions (void) + #endif + } + ++static void ++test_dbus_export_error_handling (void) ++{ ++ GRand *rand = NULL; ++ RandomMenu *menu = NULL; ++ GDBusConnection *bus; ++ GError *local_error = NULL; ++ guint id1, id2; ++ ++ g_test_summary ("Test that error handling of menu model export failure works"); ++ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); ++ ++ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); ++ ++ rand = g_rand_new_with_seed (g_test_rand_int ()); ++ menu = random_menu_new (rand, 2); ++ ++ id1 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); ++ g_assert_no_error (local_error); ++ g_assert_cmpuint (id1, !=, 0); ++ ++ /* Trigger a failure by trying to export on a path which is already in use */ ++ id2 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); ++ g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); ++ g_assert_cmpuint (id2, ==, 0); ++ g_clear_error (&local_error); ++ ++ g_dbus_connection_unexport_menu_model (bus, id1); ++ ++ while (g_main_context_iteration (NULL, FALSE)); ++ ++ g_clear_object (&menu); ++ g_rand_free (rand); ++ g_clear_object (&bus); ++} ++ + static gpointer + do_modify (gpointer data) + { +@@ -1658,6 +1694,7 @@ main (int argc, char **argv) + g_test_add_func ("/gmenu/dbus/threaded", test_dbus_threaded); + g_test_add_func ("/gmenu/dbus/peer/roundtrip", test_dbus_peer_roundtrip); + g_test_add_func ("/gmenu/dbus/peer/subscriptions", test_dbus_peer_subscriptions); ++ g_test_add_func ("/gmenu/dbus/export/error-handling", test_dbus_export_error_handling); + g_test_add_func ("/gmenu/attributes", test_attributes); + g_test_add_func ("/gmenu/attributes/iterate", test_attribute_iter); + g_test_add_func ("/gmenu/links", test_links); diff --git a/debian/patches/series b/debian/patches/series index 9a3a42017..ddd1784df 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,20 @@ -gdbusconnection-Fix-test-signal-subscription-ordering.patch -gdbusconnection-Allow-name-owners-to-have-the-syntax-of-a.patch +gdbusmessage-Clean-the-cached-arg0-when-setting-the-messa.patch +glib-tests-constructor-Add-test-dependency-on-constructor.patch +girrepository-tests-Add-full-gir-dependencies-on-tests.patch +vsaprintf-Use-proper-size-for-mp_limb_t-to-please-msys2-m.patch +tests-Ignore-Wdiscarded-qualifiers-with-volatile-atomics-.patch +tests-Fix-transposed-arguments-to-g_aligned_alloc.patch +girepository-Don-t-assume-a-bitfield-has-a-fixed-size.patch +glocalfile-Trash-free-values-when-done-avoiding-leaks-on-.patch +gio-tests-gsettings-Cleanup-allocated-new-locales.patch +glib-tests-unicode-Cleanup-allocated-old-locale-if-tests-.patch +glib-tests-gutils-user-database-Add-test-dependency-on-pr.patch +girepository-introspection-Properly-check-for-sanitizer-v.patch +glib-tests-mapping-Check-the-exit-status-of-the-child-pro.patch +glib-tests-mapping-Unref-the-mapped-file-on-exit.patch +gmenuexporter-Fix-a-NULL-pointer-dereference-on-an-error-.patch +gactiongroupexporter-Fix-memory-problems-on-an-error-hand.patch +tests-Fix-clang-compilation-failure-due-to-unrecognised-o.patch 01_gettext-desktopfiles.patch debian/02_gettext-desktopfiles-ubuntu.patch debian/03_disble_glib_compile_schemas_warning.patch diff --git a/debian/patches/tests-Fix-clang-compilation-failure-due-to-unrecognised-o.patch b/debian/patches/tests-Fix-clang-compilation-failure-due-to-unrecognised-o.patch new file mode 100644 index 000000000..fb298d001 --- /dev/null +++ b/debian/patches/tests-Fix-clang-compilation-failure-due-to-unrecognised-o.patch @@ -0,0 +1,33 @@ +From: Philip Withnall <pwithnall@gnome.org> +Date: Thu, 16 May 2024 12:28:35 +0100 +Subject: tests: Fix clang compilation failure due to unrecognised option in + pragma + +Sigh. + +``` +../glib/tests/atomic.c:139:32: error: unknown warning group '-Wdiscarded-qualifiers', ignored [-Werror,-Wunknown-warning-option] +\#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" + ^ +1 error generated. +``` + +Signed-off-by: Philip Withnall <pwithnall@gnome.org> +Origin: upstream, 2.80.3, commit:7548b4865f2c6c08a84fb59216a98af75bed7624 +--- + glib/tests/atomic.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c +index 82c5c9e..dff493d 100644 +--- a/glib/tests/atomic.c ++++ b/glib/tests/atomic.c +@@ -136,6 +136,8 @@ test_types (void) + * to make sure that we don’t warn when built against older third party code. */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" ++#pragma GCC diagnostic ignored "-Wpragmas" ++#pragma GCC diagnostic ignored "-Wunknown-warning-option" + #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" + g_atomic_pointer_set (&vp_str_vol, NULL); + g_atomic_pointer_set (&vp_str, str); diff --git a/debian/patches/tests-Fix-transposed-arguments-to-g_aligned_alloc.patch b/debian/patches/tests-Fix-transposed-arguments-to-g_aligned_alloc.patch new file mode 100644 index 000000000..a28433142 --- /dev/null +++ b/debian/patches/tests-Fix-transposed-arguments-to-g_aligned_alloc.patch @@ -0,0 +1,35 @@ +From: Philip Withnall <pwithnall@gnome.org> +Date: Wed, 15 May 2024 10:51:50 +0100 +Subject: tests: Fix transposed arguments to g_aligned_alloc() +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Spotted by GCC 14’s `-Werror=calloc-transposed-args`. Thanks, GCC 14. + +Signed-off-by: Philip Withnall <pwithnall@gnome.org> +Origin: upstream, 2.80.3, commit:88e0dca208564c3d100d88f2045b4c834ad311e4 +--- + glib/tests/mem-overflow.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c +index f195341..b8b65c1 100644 +--- a/glib/tests/mem-overflow.c ++++ b/glib/tests/mem-overflow.c +@@ -71,11 +71,11 @@ MEM_OVERFLOW_TEST (new0_b, p = g_new0 (X, b)) + MEM_OVERFLOW_TEST (renew_a, p = g_malloc (1); p = g_renew (X, p, a)) + MEM_OVERFLOW_TEST (renew_b, p = g_malloc (1); p = g_renew (X, p, b)) + +-MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (sizeof(X), a, 16), g_aligned_free) +-MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (sizeof(X), b, 16), g_aligned_free) ++MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (a, sizeof(X), 16), g_aligned_free) ++MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (b, sizeof(X), 16), g_aligned_free) + +-MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (sizeof(X), a, 16), g_aligned_free) +-MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (sizeof(X), b, 16), g_aligned_free) ++MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (a, sizeof(X), 16), g_aligned_free) ++MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (b, sizeof(X), 16), g_aligned_free) + + static void + mem_overflow_malloc_0 (void) diff --git a/debian/patches/tests-Ignore-Wdiscarded-qualifiers-with-volatile-atomics-.patch b/debian/patches/tests-Ignore-Wdiscarded-qualifiers-with-volatile-atomics-.patch new file mode 100644 index 000000000..b5f7b2b6c --- /dev/null +++ b/debian/patches/tests-Ignore-Wdiscarded-qualifiers-with-volatile-atomics-.patch @@ -0,0 +1,50 @@ +From: Philip Withnall <pwithnall@gnome.org> +Date: Wed, 15 May 2024 10:33:35 +0100 +Subject: tests: Ignore -Wdiscarded-qualifiers with volatile atomics tests +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +GCC 14 now emits this warning with the tests: +``` +In file included from ../glib/gthread.h:34, + from ../glib/gasyncqueue.h:34, + from ../glib/glib.h:34, + from ../glib/tests/atomic.c:14: +../glib/tests/atomic.c: In function 'test_types': +../glib/gatomic.h:140:5: error: argument 2 of '__atomic_store' discards 'volatile' qualifier [-Werror=discarded-qualifiers] + 140 | __atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \ + | ^~~~~~~~~~~~~~ +../glib/tests/atomic.c:139:3: note: in expansion of macro 'g_atomic_pointer_set' + 139 | g_atomic_pointer_set (&vp_str_vol, NULL); + | ^~~~~~~~~~~~~~~~~~~~ +cc1.exe: all warnings being treated as errors +``` + +I can’t think of a way to cast around this in the definition of +`g_atomic_pointer_set()` without making the behaviour worse (less type +safe) for modern non-volatile atomic variables. + +We would like to strongly nudge users of GLib away from declaring atomic +variables as `volatile`, so letting another compiler warning be emitted +when they do is not the end of the world. As long as it doesn’t stop old +code compiling (without `-Werror`). + +Signed-off-by: Philip Withnall <pwithnall@gnome.org> +Origin: upstream, 2.80.3, commit:8714b87dbe14dfc0c76a339c92e77c6f2b21981f +--- + glib/tests/atomic.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c +index 9d57d21..82c5c9e 100644 +--- a/glib/tests/atomic.c ++++ b/glib/tests/atomic.c +@@ -136,6 +136,7 @@ test_types (void) + * to make sure that we don’t warn when built against older third party code. */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" ++#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" + g_atomic_pointer_set (&vp_str_vol, NULL); + g_atomic_pointer_set (&vp_str, str); + res = g_atomic_pointer_compare_and_exchange (&vp_str_vol, NULL, str); diff --git a/debian/patches/vsaprintf-Use-proper-size-for-mp_limb_t-to-please-msys2-m.patch b/debian/patches/vsaprintf-Use-proper-size-for-mp_limb_t-to-please-msys2-m.patch new file mode 100644 index 000000000..1847d189c --- /dev/null +++ b/debian/patches/vsaprintf-Use-proper-size-for-mp_limb_t-to-please-msys2-m.patch @@ -0,0 +1,22 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> +Date: Sat, 11 May 2024 01:23:34 +0200 +Subject: vsaprintf: Use proper size for mp_limb_t to please msys2-mingw32 CI + +Origin: upstream, 2.80.3, commit:2f35c32c34020d2dad311758d02500e35ff2619c +--- + glib/gnulib/vasnprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c +index a5b68db..7e151b4 100644 +--- a/glib/gnulib/vasnprintf.c ++++ b/glib/gnulib/vasnprintf.c +@@ -379,7 +379,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) + { + /* src1 or src2 is zero. */ + dest->nlimbs = 0; +- dest->limbs = (mp_limb_t *) malloc (1); ++ dest->limbs = (mp_limb_t *) malloc (sizeof (mp_limb_t)); + } + else + { diff --git a/debian/patches/workarounds/gmenumodel-test-Mark-as-flaky.patch b/debian/patches/workarounds/gmenumodel-test-Mark-as-flaky.patch index b8a9cd7b8..0d3d96b5d 100644 --- a/debian/patches/workarounds/gmenumodel-test-Mark-as-flaky.patch +++ b/debian/patches/workarounds/gmenumodel-test-Mark-as-flaky.patch @@ -12,7 +12,7 @@ Forwarded: no 1 file changed, 6 insertions(+) diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c -index d75f36a..1c83987 100644 +index 22d1b4d..b861889 100644 --- a/gio/tests/gmenumodel.c +++ b/gio/tests/gmenumodel.c @@ -1153,6 +1153,12 @@ test_dbus_peer_subscriptions (void) diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build index e5e6726e2..47c5ecf3a 100644 --- a/docs/reference/glib/meson.build +++ b/docs/reference/glib/meson.build @@ -23,7 +23,7 @@ if get_option('documentation') rst2html5 = find_program('rst2html5', 'rst2html5.py', required: false) if rst2html5.found() - spec_path = docs_dir + spec_path = docs_dir / 'glib-2.0' figures = files( 'gvariant-byte-boundaries.svg', diff --git a/gio/gactiongroupexporter.c b/gio/gactiongroupexporter.c index 3ec1db224..1e253ec88 100644 --- a/gio/gactiongroupexporter.c +++ b/gio/gactiongroupexporter.c @@ -531,10 +531,8 @@ org_gtk_Actions_method_call (GDBusConnection *connection, } static void -g_action_group_exporter_free (gpointer user_data) +g_action_group_exporter_free (GActionGroupExporter *exporter) { - GActionGroupExporter *exporter = user_data; - g_signal_handlers_disconnect_by_func (exporter->action_group, g_action_group_exporter_action_added, exporter); g_signal_handlers_disconnect_by_func (exporter->action_group, @@ -616,15 +614,6 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, } exporter = g_slice_new (GActionGroupExporter); - id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, - exporter, g_action_group_exporter_free, error); - - if (id == 0) - { - g_slice_free (GActionGroupExporter, exporter); - return 0; - } - exporter->context = g_main_context_ref_thread_default (); exporter->pending_changes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); exporter->pending_source = NULL; @@ -632,14 +621,20 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, exporter->connection = g_object_ref (connection); exporter->object_path = g_strdup (object_path); - g_signal_connect (action_group, "action-added", - G_CALLBACK (g_action_group_exporter_action_added), exporter); - g_signal_connect (action_group, "action-removed", - G_CALLBACK (g_action_group_exporter_action_removed), exporter); - g_signal_connect (action_group, "action-state-changed", - G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); - g_signal_connect (action_group, "action-enabled-changed", - G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); + id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, + exporter, (GDestroyNotify) g_action_group_exporter_free, error); + + if (id != 0) + { + g_signal_connect (action_group, "action-added", + G_CALLBACK (g_action_group_exporter_action_added), exporter); + g_signal_connect (action_group, "action-removed", + G_CALLBACK (g_action_group_exporter_action_removed), exporter); + g_signal_connect (action_group, "action-state-changed", + G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); + g_signal_connect (action_group, "action-enabled-changed", + G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); + } return id; } diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 958444788..4c1d2e24a 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -2380,6 +2380,9 @@ name_watcher_deliver_name_owner_changed_unlocked (SignalData *name_watcher, /* Our caller already checked this */ g_assert (g_strcmp0 (name_watcher->arg0, name) == 0); + /* FIXME: This should be validating that `new_owner` is a unique name, + * but IBus’ implementation of a message bus is not compliant with the spec. + * See https://gitlab.gnome.org/GNOME/glib/-/issues/3353 */ if (G_LIKELY (new_owner[0] == '\0' || g_dbus_is_name (new_owner))) name_watcher_set_name_owner_unlocked (name_watcher, new_owner); else @@ -2432,6 +2435,9 @@ name_watcher_deliver_get_name_owner_reply_unlocked (SignalData *name_watcher, g_variant_get (body, "(&s)", &new_owner); + /* FIXME: This should be validating that `new_owner` is a unique name, + * but IBus’ implementation of a message bus is not compliant with the spec. + * See https://gitlab.gnome.org/GNOME/glib/-/issues/3353 */ if (G_LIKELY (g_dbus_is_name (new_owner))) name_watcher_set_name_owner_unlocked (name_watcher, new_owner); else diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c index 5a5fec880..b7074f79b 100644 --- a/gio/gdbusmessage.c +++ b/gio/gdbusmessage.c @@ -1155,10 +1155,12 @@ g_dbus_message_set_body (GDBusMessage *message, if (message->body != NULL) g_variant_unref (message->body); + + g_clear_pointer (&message->arg0_cache, g_variant_unref); + if (body == NULL) { message->body = NULL; - message->arg0_cache = NULL; g_dbus_message_set_signature (message, NULL); } else @@ -1172,8 +1174,6 @@ g_dbus_message_set_body (GDBusMessage *message, if (g_variant_is_of_type (message->body, G_VARIANT_TYPE_TUPLE) && g_variant_n_children (message->body) > 0) message->arg0_cache = g_variant_get_child_value (message->body, 0); - else - message->arg0_cache = NULL; type_string = g_variant_get_type_string (body); type_string_len = strlen (type_string); diff --git a/gio/glocalfile.c b/gio/glocalfile.c index ceb888ad8..56ee5e5b4 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -2284,6 +2284,7 @@ g_local_file_trash (GFile *file, data = g_strdup_printf ("[Trash Info]\nPath=%s\nDeletionDate=%s\n", original_name_escaped, delete_time); g_free (delete_time); + g_clear_pointer (&original_name_escaped, g_free); if (!g_file_set_contents_full (infofile, data, -1, G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING, @@ -2291,6 +2292,7 @@ g_local_file_trash (GFile *file, { g_unlink (infofile); + g_free (data); g_free (filesdir); g_free (trashname); g_free (infofile); @@ -2298,6 +2300,8 @@ g_local_file_trash (GFile *file, return FALSE; } + g_clear_pointer (&data, g_free); + /* TODO: Maybe we should verify that you can delete the file from the trash * before moving it? OTOH, that is hard, as it needs a recursive scan */ @@ -2341,9 +2345,6 @@ g_local_file_trash (GFile *file, /* TODO: Do we need to update mtime/atime here after the move? */ g_free (infofile); - g_free (data); - - g_free (original_name_escaped); g_free (trashname); return TRUE; diff --git a/gio/gmenuexporter.c b/gio/gmenuexporter.c index 909780cb2..1d4db1352 100644 --- a/gio/gmenuexporter.c +++ b/gio/gmenuexporter.c @@ -707,11 +707,9 @@ g_menu_exporter_create_group (GMenuExporter *exporter) } static void -g_menu_exporter_free (gpointer user_data) +g_menu_exporter_free (GMenuExporter *exporter) { - GMenuExporter *exporter = user_data; - - g_menu_exporter_menu_free (exporter->root); + g_clear_pointer (&exporter->root, g_menu_exporter_menu_free); g_clear_pointer (&exporter->peer_remote, g_menu_exporter_remote_free); g_hash_table_unref (exporter->remotes); g_hash_table_unref (exporter->groups); @@ -794,21 +792,16 @@ g_dbus_connection_export_menu_model (GDBusConnection *connection, guint id; exporter = g_slice_new0 (GMenuExporter); - - id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), - &vtable, exporter, g_menu_exporter_free, error); - - if (id == 0) - { - g_slice_free (GMenuExporter, exporter); - return 0; - } - exporter->connection = g_object_ref (connection); exporter->object_path = g_strdup (object_path); exporter->groups = g_hash_table_new (NULL, NULL); exporter->remotes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_menu_exporter_remote_free); - exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); + + id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), + &vtable, exporter, (GDestroyNotify) g_menu_exporter_free, error); + + if (id != 0) + exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); return id; } diff --git a/gio/tests/actions.c b/gio/tests/actions.c index a24c52c5e..2b7a100fc 100644 --- a/gio/tests/actions.c +++ b/gio/tests/actions.c @@ -1125,6 +1125,46 @@ test_dbus_export (void) session_bus_down (); } +static void +test_dbus_export_error_handling (void) +{ + GDBusConnection *bus = NULL; + GSimpleActionGroup *group = NULL; + GError *local_error = NULL; + guint id1, id2; + + g_test_summary ("Test that error handling of action group export failure works"); + g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); + + session_bus_up (); + bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + + group = g_simple_action_group_new (); + g_simple_action_group_add_entries (group, + exported_entries, + G_N_ELEMENTS (exported_entries), + NULL); + + id1 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); + g_assert_no_error (local_error); + g_assert_cmpuint (id1, !=, 0); + + /* Trigger a failure by trying to export on a path which is already in use */ + id2 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); + g_assert_cmpuint (id2, ==, 0); + g_clear_error (&local_error); + + g_dbus_connection_unexport_action_group (bus, id1); + + while (g_main_context_iteration (NULL, FALSE)); + + g_object_unref (group); + g_object_unref (bus); + + session_bus_down (); +} + static gpointer do_export (gpointer data) { @@ -1448,6 +1488,7 @@ main (int argc, char **argv) g_test_add_func ("/actions/entries", test_entries); g_test_add_func ("/actions/parse-detailed", test_parse_detailed); g_test_add_func ("/actions/dbus/export", test_dbus_export); + g_test_add_func ("/actions/dbus/export/error-handling", test_dbus_export_error_handling); g_test_add_func ("/actions/dbus/threaded", test_dbus_threaded); g_test_add_func ("/actions/dbus/bug679509", test_bug679509); g_test_add_func ("/actions/property", test_property_actions); diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c index 1c83987a1..b8618891f 100644 --- a/gio/tests/gmenumodel.c +++ b/gio/tests/gmenumodel.c @@ -1165,6 +1165,42 @@ test_dbus_peer_subscriptions (void) #endif } +static void +test_dbus_export_error_handling (void) +{ + GRand *rand = NULL; + RandomMenu *menu = NULL; + GDBusConnection *bus; + GError *local_error = NULL; + guint id1, id2; + + g_test_summary ("Test that error handling of menu model export failure works"); + g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); + + bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + + rand = g_rand_new_with_seed (g_test_rand_int ()); + menu = random_menu_new (rand, 2); + + id1 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); + g_assert_no_error (local_error); + g_assert_cmpuint (id1, !=, 0); + + /* Trigger a failure by trying to export on a path which is already in use */ + id2 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); + g_assert_cmpuint (id2, ==, 0); + g_clear_error (&local_error); + + g_dbus_connection_unexport_menu_model (bus, id1); + + while (g_main_context_iteration (NULL, FALSE)); + + g_clear_object (&menu); + g_rand_free (rand); + g_clear_object (&bus); +} + static gpointer do_modify (gpointer data) { @@ -1664,6 +1700,7 @@ main (int argc, char **argv) g_test_add_func ("/gmenu/dbus/threaded", test_dbus_threaded); g_test_add_func ("/gmenu/dbus/peer/roundtrip", test_dbus_peer_roundtrip); g_test_add_func ("/gmenu/dbus/peer/subscriptions", test_dbus_peer_subscriptions); + g_test_add_func ("/gmenu/dbus/export/error-handling", test_dbus_export_error_handling); g_test_add_func ("/gmenu/attributes", test_attributes); g_test_add_func ("/gmenu/attributes/iterate", test_attribute_iter); g_test_add_func ("/gmenu/links", test_links); diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index 6995feefd..b12d25973 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -924,6 +924,8 @@ test_l10n_time (void) g_assert_true (original_locale != (locale_t) 0); new_locale = duplocale (original_locale); g_assert_true (new_locale != (locale_t) 0); + g_clear_pointer (&new_locale, freelocale); + new_locale = newlocale (LC_TIME_MASK, "C", new_locale); g_assert_true (new_locale != (locale_t) 0); result = uselocale (new_locale); @@ -936,6 +938,7 @@ test_l10n_time (void) g_assert_cmpstr (str, ==, "12:00 AM"); g_free (str); + g_clear_pointer (&new_locale, freelocale); str = NULL; new_locale = newlocale (LC_TIME_MASK, "de_DE.UTF-8", new_locale); @@ -964,7 +967,7 @@ test_l10n_time (void) result = uselocale (original_locale); g_assert_true (result == new_locale); - freelocale (new_locale); + g_clear_pointer (&new_locale, freelocale); g_object_unref (settings); #endif diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h index 8ff312365..29156c5b4 100644 --- a/girepository/girepository-private.h +++ b/girepository/girepository-private.h @@ -57,7 +57,8 @@ struct _GIBaseInfo GITypelib *typelib; uint32_t offset; - uint32_t type_is_embedded : 1; /* Used by GITypeInfo */ + unsigned int type_is_embedded : 1; /* Used by GITypeInfo */ + unsigned int padding_bitfield : 31; /* For future expansion */ /* A copy of GIBaseInfo is exposed publicly for stack-allocated derivatives * such as GITypeInfo, so its size is now ABI. */ diff --git a/girepository/introspection/meson.build b/girepository/introspection/meson.build index 9405686c1..b23d04884 100644 --- a/girepository/introspection/meson.build +++ b/girepository/introspection/meson.build @@ -9,7 +9,7 @@ gi_gen_shared_sources = [ gi_gen_env_variables = environment() -if get_option('b_sanitize') != '' +if get_option('b_sanitize') != 'none' gi_gen_env_variables.append( 'ASAN_OPTIONS', 'verify_asan_link_order=0', separator: ',') endif diff --git a/girepository/tests/meson.build b/girepository/tests/meson.build index 7f5b70964..a8e5b3d19 100644 --- a/girepository/tests/meson.build +++ b/girepository/tests/meson.build @@ -12,32 +12,54 @@ girepository_tests = { # Some tests require GIR files to have been generated if enable_gir + glib_gir_testing_dep = glib_gir + gobject_gir_testing_dep = [ + glib_gir_testing_dep, + gobject_gir, + ] + + gmodule_gir_testing_dep = [ + glib_gir_testing_dep, + gmodule_gir, + ] + + gio_gir_testing_dep = [ + gobject_gir_testing_dep, + gmodule_gir_testing_dep, + gio_gir, + ] + + girepository_gir_testing_dep = [ + gio_gir_testing_dep, + girepository_gir, + ] + girepository_tests += { 'function-info' : { 'dependencies': [libffi_dep], - 'depends': [glib_gir], + 'depends': glib_gir_testing_dep, }, 'object-info' : { - 'depends': [gio_gir], + 'depends': gio_gir_testing_dep, }, 'registered-type-info' : { - 'depends': [gobject_gir], + 'depends': gobject_gir_testing_dep, }, 'repository' : { - 'depends': [glib_gir, gio_gir, gobject_gir], + 'depends': gio_gir_testing_dep, }, 'repository-search-paths' : { 'c_args': '-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir), - 'depends': [glib_gir], + 'depends': glib_gir_testing_dep, }, 'struct-info' : { - 'depends': [gobject_gir], + 'depends': gobject_gir_testing_dep, }, 'throws' : { - 'depends': [glib_gir, gio_gir], + 'depends': gio_gir_testing_dep, }, 'union-info' : { - 'depends': [glib_gir], + 'depends': glib_gir_testing_dep, }, } @@ -45,7 +67,7 @@ if enable_gir girepository_tests += { 'autoptr-girepository' : { 'source' : 'autoptr.c', - 'depends': [glib_gir, gio_gir], + 'depends': gio_gir_testing_dep, }, } endif diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c index a5b68db8c..7e151b462 100644 --- a/glib/gnulib/vasnprintf.c +++ b/glib/gnulib/vasnprintf.c @@ -379,7 +379,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { /* src1 or src2 is zero. */ dest->nlimbs = 0; - dest->limbs = (mp_limb_t *) malloc (1); + dest->limbs = (mp_limb_t *) malloc (sizeof (mp_limb_t)); } else { diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c index 9d57d2114..dff493d27 100644 --- a/glib/tests/atomic.c +++ b/glib/tests/atomic.c @@ -136,6 +136,9 @@ test_types (void) * to make sure that we don’t warn when built against older third party code. */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" g_atomic_pointer_set (&vp_str_vol, NULL); g_atomic_pointer_set (&vp_str, str); res = g_atomic_pointer_compare_and_exchange (&vp_str_vol, NULL, str); diff --git a/glib/tests/mapping.c b/glib/tests/mapping.c index 99cb8eee0..bbd4de8b0 100644 --- a/glib/tests/mapping.c +++ b/glib/tests/mapping.c @@ -22,6 +22,7 @@ #ifdef G_OS_UNIX #include <unistd.h> +#include <sys/wait.h> #endif #ifdef G_OS_WIN32 #include <process.h> @@ -124,6 +125,7 @@ child_main (void) g_free (childname); g_free (global_filename); g_free (dir); + g_mapped_file_unref (map); signal_parent (NULL); } @@ -201,8 +203,10 @@ test_child_private (void) gsize len; gchar *child_argv[4]; GPid child_pid; + GSpawnFlags spawn_flags = G_SPAWN_DEFAULT; #ifndef G_OS_WIN32 GMainLoop *loop; + int wait_status; #endif gchar pid[100]; gchar *dir, *global_filename, *childname; @@ -221,6 +225,7 @@ test_child_private (void) #ifndef G_OS_WIN32 signal (SIGUSR1, handle_usr1); + spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD; #endif g_snprintf (pid, sizeof(pid), "%d", getpid ()); @@ -230,7 +235,7 @@ test_child_private (void) child_argv[3] = NULL; result = g_spawn_async (dir, child_argv, NULL, - 0, NULL, NULL, &child_pid, &error); + spawn_flags, NULL, NULL, &child_pid, &error); g_assert_no_error (error); g_assert_true (result); g_test_message ("test_child_private: child spawned"); @@ -261,6 +266,10 @@ test_child_private (void) #ifndef G_OS_WIN32 g_idle_add (check_stop, loop); g_main_loop_run (loop); + waitpid (child_pid, &wait_status, 0); + g_test_message ("Child exited with status %d", wait_status); + g_spawn_check_wait_status (wait_status, &error); + g_assert_no_error (error); #else g_usleep (2000000); #endif diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c index f19534102..b8b65c17a 100644 --- a/glib/tests/mem-overflow.c +++ b/glib/tests/mem-overflow.c @@ -71,11 +71,11 @@ MEM_OVERFLOW_TEST (new0_b, p = g_new0 (X, b)) MEM_OVERFLOW_TEST (renew_a, p = g_malloc (1); p = g_renew (X, p, a)) MEM_OVERFLOW_TEST (renew_b, p = g_malloc (1); p = g_renew (X, p, b)) -MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (sizeof(X), a, 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (sizeof(X), b, 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (a, sizeof(X), 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (b, sizeof(X), 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (sizeof(X), a, 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (sizeof(X), b, 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (a, sizeof(X), 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (b, sizeof(X), 16), g_aligned_free) static void mem_overflow_malloc_0 (void) diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 85f40d2e1..c448b8156 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -263,7 +263,7 @@ else glib_tests += { 'gutils-user-database' : { - 'depends' : [], + 'depends' : getpwuid_preload, 'env' : { var_preload: getpwuid_preload.full_path() }, @@ -350,6 +350,7 @@ if host_machine.system() == 'windows' or have_dlopen_dlsym '-DBUILD_TEST_EXECUTABLE', '-DPREFIX=app'], 'dependencies' : libdl_dep, + 'depends': constructor_lib, 'link_with': [constructor_helper] } } diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c index e91425aa7..cb74068a5 100644 --- a/glib/tests/unicode.c +++ b/glib/tests/unicode.c @@ -525,6 +525,7 @@ test_turkish_strupdown (void) if (oldlocale == NULL) { g_test_skip ("locale tr_TR not available"); + g_free (old_lang); return; } diff --git a/meson.build b/meson.build index 55094c735..b995ebc06 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('glib', 'c', - version : '2.80.1', + version : '2.80.2', # NOTE: See the policy in docs/meson-version.md before changing the Meson dependency meson_version : '>= 1.2.0', default_options : [ |