public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ibus] autotool: ibus-daemon always will exits with parent's death.
@ 2026-05-31 2:07 Takao Fujiwara
0 siblings, 0 replies; only message in thread
From: Takao Fujiwara @ 2026-05-31 2:07 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/ibus
Branch : autotool
Commit : c678e78928e78e374b4742b0b77d223bb724a95b
Author : Takao Fujiwara <tfujiwar@redhat.com>
Date : 2019-08-06T19:05:15+09:00
Stats : +124/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/ibus/c/c678e78928e78e374b4742b0b77d223bb724a95b?branch=autotool
Log:
ibus-daemon always will exits with parent's death.
---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index 837ffcc..0b2eead 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -15151,3 +15151,123 @@ index b7a72285..3045d601 100755
--
2.21.0
+From 32572618cdcc36162b5769eb4c71964db9734061 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Tue, 6 Aug 2019 18:55:14 +0900
+Subject: [PATCH] bus: Exit ibus-daemon with parent's death
+
+ibus-daemon can be restarted unexpectedly during logging out the session
+and double ibus-x11 prevent from enabling XIM in XGetSelectionOwner()
+for the "ibus" atom.
+ibus-daemon always will exit the process when the parent process dies
+to avoid this problem.
+---
+ bus/main.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ configure.ac | 3 +++
+ 2 files changed, 58 insertions(+), 1 deletion(-)
+
+diff --git a/bus/main.c b/bus/main.c
+index 3223d541..e11a5ebd 100644
+--- a/bus/main.c
++++ b/bus/main.c
+@@ -33,6 +33,10 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+
++#ifdef HAVE_SYS_PRCTL_H
++#include <sys/prctl.h>
++#endif
++
+ #include "global.h"
+ #include "ibusimpl.h"
+ #include "server.h"
+@@ -161,6 +165,15 @@ daemon (gint nochdir, gint noclose)
+ }
+ #endif
+
++#ifdef HAVE_SYS_PRCTL_H
++static void
++_sig_usr1_handler (int sig)
++{
++ g_warning ("The parent process died.");
++ bus_server_quit (FALSE);
++}
++#endif
++
+ gint
+ main (gint argc, gchar **argv)
+ {
+@@ -201,7 +214,7 @@ main (gint argc, gchar **argv)
+ /* daemonize process */
+ if (daemonize) {
+ if (daemon (1, 0) != 0) {
+- g_printerr ("Can not daemonize ibus.\n");
++ g_printerr ("Cannot daemonize ibus.\n");
+ exit (-1);
+ }
+ }
+@@ -299,6 +312,47 @@ main (gint argc, gchar **argv)
+ exit (-1);
+ }
+
++ if (!daemonize) {
++ if (getppid () == 1) {
++ g_warning ("The parent process died.");
++ exit (0);
++ }
++#ifdef HAVE_SYS_PRCTL_H
++ /* Currently ibus-x11 detects XIOError and assume the error as the
++ * desktop session is closed and ibus-x11 calls Exit D-Bus method to
++ * exit ibus-daemon. But a few desktop sessions cause XError before
++ * XIOError and GTK does not allow to bind XError by applications and
++ * GTK calls gdk_x_error() with XError.
++ *
++ * E.g. GdkX11Screen calls XGetSelectionOwner() for "_XSETTINGS_S?"
++ * atoms during the logout but the selection owner already becomes
++ * NULL and the NULL window causes XError with
++ * gdk_x11_window_foreign_new_for_display().
++ *
++ * Since ibus-x11 exits with XError before XIOError, gnome-shell
++ * can detects the exit of ibus-daemon a little earlier and
++ * gnome-shell restarts ibus-daemon but gnome-shell dies soon.
++ * Then gnome-shell dies but ibus-daemon is alive, it's a problem.
++ * Because it causes double ibus-x11 of GDM and a login user
++ * and double XSetSelectionOwner() is not allowed for the unique
++ * "ibus" atom and the user cannot use XIM but not GtkIMModule.
++ *
++ * Probably we could fix the ibus process problem if we would fix
++ * XError about the X selection owner or stop to restart ibus-daemon
++ * in gonme-shell when the session is logging out.
++ * Maybe using SessionManager.LogoutRemote() or
++ * global.screen.get_display().get_xdisplay()
++ * But I assume thereare other scenarios to causes the problem.
++ *
++ * And I decided ibus-daemon always exits with the parent's death here
++ * to avoid unexpected ibus restarts during the logout.
++ */
++ if (prctl (PR_SET_PDEATHSIG, SIGUSR1))
++ g_printerr ("Cannot bind SIGUSR1 for parent death\n");
++ else
++ signal (SIGUSR1, _sig_usr1_handler);
++#endif
++ }
+ bus_server_run ();
+ return 0;
+ }
+diff --git a/configure.ac b/configure.ac
+index f1df3ac1..fdd316a9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -140,6 +140,9 @@ AC_ISC_POSIX
+ AC_HEADER_STDC
+ LT_INIT
+
++# Check header filess.
++AC_CHECK_HEADERS([sys/prctl.h])
++
+ # Check functions.
+ AC_CHECK_FUNCS(daemon)
+
+--
+2.21.0
+
diff --git a/ibus.spec b/ibus.spec
index 5a22786..e321945 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.20
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@@ -464,6 +464,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
+* Tue Aug 06 2019 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.20-9
+- ibus-daemon always will exits with parent's death.
+
* Wed Jul 31 2019 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.20-8
- Fix a wrong result in direct testing instead of GNOME desktop testing
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-31 2:07 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:07 [rpms/ibus] autotool: ibus-daemon always will exits with parent's death Takao Fujiwara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox