public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ibus] autotool: Resolves: #2169205 Return error if D-Bus set/get property method is failed
@ 2026-05-31 2:08 Takao Fujiwara
0 siblings, 0 replies; only message in thread
From: Takao Fujiwara @ 2026-05-31 2:08 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/ibus
Branch : autotool
Commit : d37bb57e20ee3d9388120285aee67f66c1298fa3
Author : Takao Fujiwara <tfujiwar@redhat.com>
Date : 2023-02-17T21:39:46+09:00
Stats : +476/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/ibus/c/d37bb57e20ee3d9388120285aee67f66c1298fa3?branch=autotool
Log:
Resolves: #2169205 Return error if D-Bus set/get property method is failed
---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index ffb9b37..53137f6 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -9127,3 +9127,475 @@ index cc12ac5a..8aa27b66 100644
--
2.38.1
+From f788f1f8317797ebc59f5f59acb4390824e5a4ef Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Fri, 17 Feb 2023 20:35:10 +0900
+Subject: [PATCH] Return error if D-Bus set/get property method is failed
+
+D-Bus set/get property methods are called from DBusConnection
+APIs invoke_set_property_in_idle_cb() and
+invoke_get_property_in_idle_cb() and the error values cannot be
+null if the methods are failed.
+
+BUG=rhbz#2169205
+---
+ bus/ibusimpl.c | 86 ++++++++++++++++++------------------------
+ bus/inputcontext.c | 27 +++++++++++--
+ src/ibusengine.c | 44 ++++++++++++++-------
+ src/ibusenginesimple.c | 2 +-
+ src/ibusservice.c | 27 ++++++++++---
+ 5 files changed, 113 insertions(+), 73 deletions(-)
+
+diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
+index c2ae88df..f2ab2b30 100644
+--- a/bus/ibusimpl.c
++++ b/bus/ibusimpl.c
+@@ -700,11 +700,14 @@ _ibus_get_address (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
+- *error = NULL;
++ GVariant *retval = g_variant_new_string (bus_server_get_address ());
++ if (!retval) {
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "Cannot get IBus address");
+ }
+-
+- return g_variant_new_string (bus_server_get_address ());
++ return retval;
+ }
+
+ static void
+@@ -1213,9 +1216,6 @@ _ibus_get_current_input_context (BusIBusImpl *ibus,
+ GError **error)
+ {
+ GVariant *retval = NULL;
+- if (error) {
+- *error = NULL;
+- }
+
+ if (!ibus->focused_context)
+ {
+@@ -1359,14 +1359,11 @@ _ibus_get_engines (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
++ GVariant *retval;
+ GVariantBuilder builder;
+ GList *engines = NULL;
+ GList *p;
+
+- if (error) {
+- *error = NULL;
+- }
+-
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
+
+ engines = g_hash_table_get_values (ibus->engine_table);
+@@ -1379,7 +1376,9 @@ _ibus_get_engines (BusIBusImpl *ibus,
+
+ g_list_free (engines);
+
+- return g_variant_builder_end (&builder);
++ retval = g_variant_builder_end (&builder);
++ g_assert (retval);
++ return retval;
+ }
+
+ static void
+@@ -1444,13 +1443,10 @@ _ibus_get_active_engines (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
++ GVariant *retval;
+ GVariantBuilder builder;
+ GList *p;
+
+- if (error) {
+- *error = NULL;
+- }
+-
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
+
+ for (p = ibus->register_engine_list; p != NULL; p = p->next) {
+@@ -1459,7 +1455,9 @@ _ibus_get_active_engines (BusIBusImpl *ibus,
+ ibus_serializable_serialize ((IBusSerializable *) p->data));
+ }
+
+- return g_variant_builder_end (&builder);
++ retval = g_variant_builder_end (&builder);
++ g_assert (retval);
++ return retval;
+ }
+
+ static void
+@@ -1528,10 +1526,8 @@ _ibus_get_use_sys_layout (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
++ if (error)
+ *error = NULL;
+- }
+-
+ return g_variant_new_boolean (ibus->use_sys_layout);
+ }
+
+@@ -1566,10 +1562,8 @@ _ibus_get_use_global_engine (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
++ if (error)
+ *error = NULL;
+- }
+-
+ return g_variant_new_boolean (ibus->use_global_engine);
+ }
+
+@@ -1607,10 +1601,6 @@ _ibus_get_global_engine (BusIBusImpl *ibus,
+ IBusEngineDesc *desc = NULL;
+ GVariant *retval = NULL;
+
+- if (error) {
+- *error = NULL;
+- }
+-
+ do {
+ if (!ibus->use_global_engine)
+ break;
+@@ -1790,10 +1780,8 @@ _ibus_get_global_engine_enabled (BusIBusImpl *ibus,
+ {
+ gboolean enabled = FALSE;
+
+- if (error) {
++ if (error)
+ *error = NULL;
+- }
+-
+ do {
+ if (!ibus->use_global_engine)
+ break;
+@@ -1849,10 +1837,6 @@ _ibus_set_preload_engines (BusIBusImpl *ibus,
+ BusFactoryProxy *factory = NULL;
+ GPtrArray *array = g_ptr_array_new ();
+
+- if (error) {
+- *error = NULL;
+- }
+-
+ g_variant_get (value, "^a&s", &names);
+
+ for (i = 0; names[i] != NULL; i++) {
+@@ -1912,11 +1896,9 @@ _ibus_get_embed_preedit_text (BusIBusImpl *ibus,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
+- *error = NULL;
+- }
+-
+- return g_variant_new_boolean (ibus->embed_preedit_text);
++ GVariant *retval = g_variant_new_boolean (ibus->embed_preedit_text);
++ g_assert (retval);
++ return retval;
+ }
+
+ /**
+@@ -1931,10 +1913,6 @@ _ibus_set_embed_preedit_text (BusIBusImpl *ibus,
+ GVariant *value,
+ GError **error)
+ {
+- if (error) {
+- *error = NULL;
+- }
+-
+ gboolean embed_preedit_text = g_variant_get_boolean (value);
+ if (embed_preedit_text != ibus->embed_preedit_text) {
+ ibus->embed_preedit_text = embed_preedit_text;
+@@ -2038,6 +2016,8 @@ bus_ibus_impl_service_get_property (IBusService *service,
+ { "EmbedPreeditText", _ibus_get_embed_preedit_text },
+ };
+
++ if (error)
++ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_IBUS) != 0) {
+ return IBUS_SERVICE_CLASS (
+ bus_ibus_impl_parent_class)->service_get_property (
+@@ -2054,9 +2034,12 @@ bus_ibus_impl_service_get_property (IBusService *service,
+ }
+ }
+
+- g_warning ("service_get_property received an unknown property: %s",
+- property_name ? property_name : "(null)");
+- return NULL;
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_get_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ g_return_val_if_reached (NULL);
+ }
+
+ /**
+@@ -2087,6 +2070,8 @@ bus_ibus_impl_service_set_property (IBusService *service,
+ { "EmbedPreeditText", _ibus_set_embed_preedit_text },
+ };
+
++ if (error)
++ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_IBUS) != 0) {
+ return IBUS_SERVICE_CLASS (
+ bus_ibus_impl_parent_class)->service_set_property (
+@@ -2104,9 +2089,12 @@ bus_ibus_impl_service_set_property (IBusService *service,
+ }
+ }
+
+- g_warning ("service_set_property received an unknown property: %s",
+- property_name ? property_name : "(null)");
+- return FALSE;
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_set_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ g_return_val_if_reached (FALSE);
+ }
+
+ BusIBusImpl *
+diff --git a/bus/inputcontext.c b/bus/inputcontext.c
+index 72041ecb..e76bbdfc 100644
+--- a/bus/inputcontext.c
++++ b/bus/inputcontext.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2014 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2015-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -1388,6 +1388,8 @@ bus_input_context_service_set_property (IBusService *service,
+ GVariant *value,
+ GError **error)
+ {
++ if (error)
++ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
+ return IBUS_SERVICE_CLASS (bus_input_context_parent_class)->
+ service_set_property (service,
+@@ -1400,10 +1402,22 @@ bus_input_context_service_set_property (IBusService *service,
+ error);
+ }
+
+- if (!bus_input_context_service_authorized_method (service, connection))
++ if (!BUS_IS_INPUT_CONTEXT (service)) {
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "%p is not BusInputContext.", service);
+ return FALSE;
+-
+- g_return_val_if_fail (BUS_IS_INPUT_CONTEXT (service), FALSE);
++ }
++ if (!bus_input_context_service_authorized_method (service, connection)) {
++ /* No error message due to the security issue but GError is required
++ * by gdbusconnection.c:invoke_set_property_in_idle_cb() */
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ " ");
++ return FALSE;
++ }
+
+ if (g_strcmp0 (property_name, "ContentType") == 0) {
+ _ic_set_content_type (BUS_INPUT_CONTEXT (service), value);
+@@ -1414,6 +1428,11 @@ bus_input_context_service_set_property (IBusService *service,
+ return TRUE;
+ }
+
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_set_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
+ g_return_val_if_reached (FALSE);
+ }
+
+diff --git a/src/ibusengine.c b/src/ibusengine.c
+index 8aa27b66..321a58a1 100644
+--- a/src/ibusengine.c
++++ b/src/ibusengine.c
+@@ -1512,11 +1512,10 @@ _ibus_engine_get_active_surrounding_text (IBusEngine *engine,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
+- *error = NULL;
+- }
+-
+- return g_variant_new_boolean (engine->priv->has_active_surrounding_text);
++ GVariant *retval = g_variant_new_boolean (
++ engine->priv->has_active_surrounding_text);
++ g_assert (retval);
++ return retval;
+ }
+
+ /**
+@@ -1529,11 +1528,9 @@ _ibus_engine_has_focus_id (IBusEngine *engine,
+ GDBusConnection *connection,
+ GError **error)
+ {
+- if (error) {
+- *error = NULL;
+- }
+-
+- return g_variant_new_boolean (engine->priv->has_focus_id);
++ GVariant *retval = g_variant_new_boolean (engine->priv->has_focus_id);
++ g_assert (retval);
++ return retval;
+ }
+
+ static GVariant *
+@@ -1556,6 +1553,8 @@ ibus_engine_service_get_property (IBusService *service,
+ { "ActiveSurroundingText", _ibus_engine_get_active_surrounding_text },
+ };
+
++ if (error)
++ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_ENGINE) != 0) {
+ return IBUS_SERVICE_CLASS (ibus_engine_parent_class)->
+ service_get_property (service,
+@@ -1575,9 +1574,12 @@ ibus_engine_service_get_property (IBusService *service,
+ }
+ }
+
+- g_warning ("service_get_property received an unknown property: %s",
+- property_name ? property_name : "(null)");
+- return NULL;
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_get_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ g_return_val_if_reached (NULL);
+ }
+
+ static gboolean
+@@ -1592,6 +1594,8 @@ ibus_engine_service_set_property (IBusService *service,
+ {
+ IBusEngine *engine = IBUS_ENGINE (service);
+
++ if (error)
++ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_ENGINE) != 0) {
+ return IBUS_SERVICE_CLASS (ibus_engine_parent_class)->
+ service_set_property (service,
+@@ -1604,8 +1608,15 @@ ibus_engine_service_set_property (IBusService *service,
+ error);
+ }
+
+- if (!ibus_engine_service_authorized_method (service, connection))
++ if (!ibus_engine_service_authorized_method (service, connection)) {
++ /* No error message due to the security issue but GError is required
++ * by gdbusconnection.c:invoke_set_property_in_idle_cb() */
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ " ");
+ return FALSE;
++ }
+
+ if (g_strcmp0 (property_name, "ContentType") == 0) {
+ guint purpose = 0;
+@@ -1629,6 +1640,11 @@ ibus_engine_service_set_property (IBusService *service,
+ return TRUE;
+ }
+
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_set_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
+ g_return_val_if_reached (FALSE);
+ }
+
+diff --git a/src/ibusenginesimple.c b/src/ibusenginesimple.c
+index 3d1668b2..409d5a56 100644
+--- a/src/ibusenginesimple.c
++++ b/src/ibusenginesimple.c
+@@ -158,7 +158,7 @@ ibus_engine_simple_init (IBusEngineSimple *simple)
+ G_RESOURCE_LOOKUP_FLAGS_NONE,
+ &error);
+ if (error) {
+- g_warning ("Nout found compose resource %s", error->message);
++ g_warning ("Not found compose resource %s", error->message);
+ g_clear_error (&error);
+ return;
+ }
+diff --git a/src/ibusservice.c b/src/ibusservice.c
+index 60255bd5..d207f707 100644
+--- a/src/ibusservice.c
++++ b/src/ibusservice.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2015-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -370,8 +370,9 @@ ibus_service_service_method_call (IBusService *service,
+ g_dbus_method_invocation_return_error (invocation,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_UNKNOWN_METHOD,
+- "%s::%s", interface_name, method_name);
+- return;
++ "%s::%s",
++ interface_name, method_name);
++ g_return_if_reached ();
+ }
+
+ static GVariant *
+@@ -383,7 +384,15 @@ ibus_service_service_get_property (IBusService *service,
+ const gchar *property_name,
+ GError **error)
+ {
+- return NULL;
++ if (error) {
++ *error = NULL;
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_get_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ }
++ g_return_val_if_reached (NULL);
+ }
+
+ static gboolean
+@@ -396,7 +405,15 @@ ibus_service_service_set_property (IBusService *service,
+ GVariant *value,
+ GError **error)
+ {
+- return FALSE;
++ if (error) {
++ *error = NULL;
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_set_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ }
++ g_return_val_if_reached (FALSE);
+ }
+
+ static void
+--
+2.38.1
+
diff --git a/ibus.spec b/ibus.spec
index 270437c..3d01183 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -50,7 +50,7 @@
Name: ibus
Version: 1.5.27
-Release: 14%{?dist}
+Release: 15%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.0-or-later
URL: https://github.com/ibus/%name/wiki
@@ -558,6 +558,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
+* Fri Feb 17 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-15
+- Resolves: #2169205 Return error if D-Bus set/get property method is failed
+
* Wed Jan 25 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-14
- Add active-surrounding-text property to IBusEngine
- Refactor surrounding text warning & free focus-id tables
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-31 2:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-31 2:08 [rpms/ibus] autotool: Resolves: #2169205 Return error if D-Bus set/get property method is failed Takao Fujiwara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox