From 88fa3a6fd551c96b13a8021f8e63214c3e6bf518 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Jul 2020 04:26:25 -0400 Subject: [PATCH] import ibus-1.5.19-12.el8 --- SOURCES/ibus-1682157-ci.patch | 246 ++++++++++++++ SOURCES/ibus-1713606-hangul-with-mouse.patch | 316 +++++++++++++++++- .../ibus-1750836-server-auth-observer.patch | 179 ++++++++++ SPECS/ibus.spec | 42 ++- 4 files changed, 765 insertions(+), 18 deletions(-) create mode 100644 SOURCES/ibus-1750836-server-auth-observer.patch diff --git a/SOURCES/ibus-1682157-ci.patch b/SOURCES/ibus-1682157-ci.patch index 28dc8ed..87e72ed 100644 --- a/SOURCES/ibus-1682157-ci.patch +++ b/SOURCES/ibus-1682157-ci.patch @@ -2391,3 +2391,249 @@ index 72537cd4..981941d5 100755 -- 2.21.0 +From 74863851e83972e86a5bdb3da3d99784fc8d4955 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Tue, 28 Jan 2020 18:46:13 +0900 +Subject: [PATCH] src/tests: Increase sleep to 3 waiting for IBusConfig + +Sleep 1 would be too short for ibus-daemon which could run all components. +ibus-config test requires the running IBusConfig and the test could fail +in some slow systems. +Sleep time will be increased to 3 to run all components. + +BUG=https://github.com/ibus/ibus/issues/2170 +--- + src/tests/ibus-config.c | 4 ++++ + src/tests/ibus-desktop-testing-runner.in | 2 +- + src/tests/runtest | 2 +- + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/tests/ibus-config.c b/src/tests/ibus-config.c +index 5e845f10..0d9812a3 100644 +--- a/src/tests/ibus-config.c ++++ b/src/tests/ibus-config.c +@@ -16,6 +16,10 @@ finish_create_config_async_success (GObject *source_object, + IBusConfig *config = + ibus_config_new_async_finish (res, &error); + ++ if (error) { ++ g_message ("Failed to generate IBusConfig: %s", error->message); ++ g_error_free (error); ++ } + g_assert (IBUS_IS_CONFIG (config)); + + /* Since we reuse single D-Bus connection, we need to remove the +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index 981941d5..0d9a847c 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -190,7 +190,7 @@ run_desktop() + HAS_GNOME=`echo $DESKTOP_COMMAND | grep gnome-session` + if [ x"$HAS_GNOME" = x ] ; then + ibus-daemon --daemonize --verbose +- sleep 1 ++ sleep 3 + fi + } + +diff --git a/src/tests/runtest b/src/tests/runtest +index ed38992f..a6e4194b 100755 +--- a/src/tests/runtest ++++ b/src/tests/runtest +@@ -180,7 +180,7 @@ run_test_case() + fi + + # Wait until all necessary components are up. +- sleep 1 ++ sleep 3 + + export GTK_IM_MODULE=ibus + fi +-- +2.24.1 + +From 7b0d091839a4f1315ba216175fb2787e86f7fa31 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Tue, 3 Mar 2020 17:08:30 +0900 +Subject: [PATCH] src/tests: Delete graves in substitution in + ibus-desktop-testing-runner + +Delete the single quotations to enclose grave chracters because +DASH saves the single quoted '`id -u`' as the raw string in the command +substitution not to be extracted. + +BUG=https://github.com/ibus/ibus/issues/2189 +--- + src/tests/ibus-desktop-testing-runner.in | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index 0d9a847c..f9238e69 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -4,7 +4,7 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2018-2019 Takao Fujiwara ++# Copyright (c) 2018-2020 Takao Fujiwara + # Copyright (c) 2018 Red Hat, Inc. + # + # This program is free software; you can redistribute it and/or modify +@@ -31,7 +31,8 @@ + # POSIX sh has no 'echo -e' + : ${ECHO:='/usr/bin/echo'} + # POSIX sh has $UID +-: ${UID:='`id -u`'} ++# DASH saves the graves in '``' as characters not to be extracted ++: ${UID:=`id -u`} + + + PROGNAME=`basename $0` +@@ -170,7 +171,7 @@ _EOF + run_dbus_daemon() + { + # Use dbus-launch --exit-with-session later instead of --sh-syntax +- export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus ++ export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus" + } + + run_desktop() +-- +2.24.1 + +From 8da016764cee9616cca4658d1fb311d6b3bfc0df Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 15 Apr 2020 17:55:03 +0900 +Subject: [PATCH] src/tests: Fix to get focus events with su in + ibus-desktop-testing-runner + +GtkWindow haven't received focus events in any test cases since Fedora 31 +whenever Ansible runs ibus-desktop-testing-runner after `su root`. +Seems su command does not run systemd automatically and now systemd +requires XDG_RUNTIME_DIR and Ansible requires root access with ssh. +This fix requires to restart sshd with modified /etc/ssh/sshd_config +with "PermitRootLogin yes" in order to run with su command. + +Ansible with ibus-desktop-testin-runner has worked fine if root console +login is used without this patch because PAM runs systemd by login. +--- + src/tests/ibus-desktop-testing-runner.in | 36 ++++++++++++++++++++++-- + 1 file changed, 33 insertions(+), 3 deletions(-) + +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index f9238e69..f760fd5b 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -49,6 +49,7 @@ PID_XORG=0 + PID_GNOME_SESSION=0 + TESTING_RUNNER="default" + TESTS="" ++TIMEOUT=300 + GREEN='\033[0;32m' + RED='\033[0;31m' + NC='\033[0m' +@@ -84,6 +85,7 @@ usage() + "-r, --runner=RUNNER Run TESTS programs with a test RUNNER.\n" \ + " RUNNDER = gnome or default.\n" \ + " default is an embedded runner.\n" \ ++"-T, --timeout=TIMEOUT Set timeout (default TIMEOUT is 300 sec).\n" \ + "-o, --output=OUTPUT_FILE OUtput the log to OUTPUT_FILE\n" \ + "-O, --result=RESULT_FILE OUtput the result to RESULT_FILE\n" \ + "" +@@ -92,8 +94,8 @@ usage() + parse_args() + { + # This is GNU getopt. "sudo port getopt" in BSD? +- ARGS=`getopt -o hvb:s:cd:t:r:o:O: --long \ +- help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,output:,result:\ ++ ARGS=`getopt -o hvb:s:cd:t:r:T:o:O: --long \ ++ help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:\ + -- "$@"`; + eval set -- "$ARGS" + while [ 1 ] ; do +@@ -106,6 +108,7 @@ parse_args() + -d | --desktop ) DESKTOP_COMMAND="$2"; shift 2;; + -t | --tests ) TESTS="$2"; shift 2;; + -r | --runner ) TESTING_RUNNER="$2"; shift 2;; ++ -T | --timeout ) TIMEOUT="$2"; shift 2;; + -o | --output ) TEST_LOG="$2"; shift 2;; + -O | --result ) RESULT_LOG="$2"; shift 2;; + -- ) shift; break;; +@@ -166,11 +169,37 @@ _EOF + fi + # `su` command does not run loginctl + export XDG_SESSION_TYPE='x11' ++ export XDG_SESSION_CLASS=user ++ # `su` command does not get focus in events without this variable. ++ # Need to restart sshd after set "PermitRootLogin yes" in sshd_config ++ if [ "x$XDG_RUNTIME_DIR" = x ] ; then ++ export XDG_RUNTIME_DIR=/run/user/$UID ++ is_root_login=`grep "^PermitRootLogin" /etc/ssh/sshd_config | grep yes` ++ if [ "x$ANSIBLE" != x ] && [ "x$is_root_login" = x ] ; then ++ print_log -e "${RED}FAIL${NC}: No permission to get focus-in events in GtkWindow with ansible" ++ echo "su command does not configure necessary login info " \ ++ "with systemd and GtkWindow cannot receive focus-events " \ ++ "when ibus-desktop-testing-runner is executed by " \ ++ "ansible-playbook." >> $TEST_LOG ++ echo "Enabling root login via sshd, restarting sshd, set " \ ++ "XDG_RUNTIME_DIR can resolve the problem under " \ ++ "ansible-playbook." >> $TEST_LOG ++ exit 255 ++ fi ++ fi ++ # Do we need XDG_SESSION_ID and XDG_SEAT? ++ #export XDG_CONFIG_DIRS=/etc/xdg ++ #export XDG_SESSION_ID=10 ++ #export XDG_SESSION_DESKTOP=gnome ++ #export XDG_SEAT=seat0 + } + + run_dbus_daemon() + { + # Use dbus-launch --exit-with-session later instead of --sh-syntax ++ # GNOME uses a unix:abstract address and it effects gsettings set values ++ # in each test case. ++ # TODO: Should we comment out this line? + export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus" + } + +@@ -288,7 +317,8 @@ run_gnome_desktop_testing_runner() + fail=1 + continue + fi +- gnome-desktop-testing-runner $tst 2>>$TEST_LOG 1>>$TEST_LOG ++ gnome-desktop-testing-runner --timeout=$TIMEOUT $tst \ ++ 2>>$TEST_LOG 1>>$TEST_LOG + retval=$? + read pass fail << EOF + `count_case_result $retval $pass $fail` +-- +2.24.1 + +From 0b9d9365988a96a2bc31c48624f9c2b8081601b6 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 22 Apr 2020 20:17:12 +0900 +Subject: [PATCH] client/gtk2: Fix typo + +--- + client/gtk2/ibusim.c | 4 ++-- + src/tests/ibus-desktop-testing-runner.in | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index f760fd5b..4232c549 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -173,7 +173,7 @@ _EOF + # `su` command does not get focus in events without this variable. + # Need to restart sshd after set "PermitRootLogin yes" in sshd_config + if [ "x$XDG_RUNTIME_DIR" = x ] ; then +- export XDG_RUNTIME_DIR=/run/user/$UID ++ export XDG_RUNTIME_DIR="/run/user/$UID" + is_root_login=`grep "^PermitRootLogin" /etc/ssh/sshd_config | grep yes` + if [ "x$ANSIBLE" != x ] && [ "x$is_root_login" = x ] ; then + print_log -e "${RED}FAIL${NC}: No permission to get focus-in events in GtkWindow with ansible" +-- +2.24.1 + diff --git a/SOURCES/ibus-1713606-hangul-with-mouse.patch b/SOURCES/ibus-1713606-hangul-with-mouse.patch index b86145f..0fabe65 100644 --- a/SOURCES/ibus-1713606-hangul-with-mouse.patch +++ b/SOURCES/ibus-1713606-hangul-with-mouse.patch @@ -739,7 +739,7 @@ index a77cf92f..09992148 100644 G_END_DECLS #endif -- -2.21.0 +2.24.1 From 7b3b8c8b0c6a41ab524e0be9474825da9cba96ac Mon Sep 17 00:00:00 2001 From: fujiwarat @@ -794,7 +794,7 @@ index 73a0eaec..82af51a1 100644 } -- -2.21.0 +2.24.1 From 4c40afba9c862b4f6651b1b971553e5e89e83343 Mon Sep 17 00:00:00 2001 From: fujiwarat @@ -859,7 +859,7 @@ index 82af51a1..ed7fea6e 100644 } -- -2.21.0 +2.24.1 From c7d8771cb9fc652cb638aa7cb8e10ea6b889509e Mon Sep 17 00:00:00 2001 From: fujiwarat @@ -889,7 +889,7 @@ index ed7fea6e..ab7ff88a 100644 } -- -2.21.0 +2.24.1 From 9ae2d4658fff3d1e7262fb4fb7ca9ce1af0a27ec Mon Sep 17 00:00:00 2001 From: fujiwarat @@ -1019,7 +1019,7 @@ index ab7ff88a..f9310867 100644 ibusimcontext->preedit_string = g_strdup (str); if (text->attrs) { -- -2.21.0 +2.24.1 From 0fd043c3b4c90855bfb4fceed4bf2f3c3635a041 Mon Sep 17 00:00:00 2001 From: fujiwarat @@ -1116,5 +1116,309 @@ index cb24d257..e78bc92f 100644 break; default: -- -2.21.0 +2.24.1 + +From be7fb813e530442897a9f9130b8a26380e5a12a1 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Tue, 8 Jan 2019 12:02:37 +0900 +Subject: [PATCH] client/gtk2: Fix Atom and Slack for Flatpak + +Seems Atom, slack, com.visualstudio.code does not enable +gtk_key_snooper_install() and this issue causes to call +gtk_im_context_filter_keypress instead of calling ibus APIs. + +BUG=https://github.com/ibus/ibus/issues/1991 +--- + client/gtk2/ibusimcontext.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index f9310867..264a747a 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -565,6 +565,10 @@ daemon_name_appeared (GDBusConnection *connection, + const gchar *owner, + gpointer data) + { ++ if (!g_strcmp0 (ibus_bus_get_service_name (_bus), IBUS_SERVICE_PORTAL)) { ++ _daemon_is_running = TRUE; ++ return; ++ } + /* If ibus-daemon is running and run ssh -X localhost, + * daemon_name_appeared() is called but ibus_get_address() == NULL + * because the hostname and display number are different between +-- +2.24.1 + +From cebe7a9553de69943b955ec99285f74961c9ee4e Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 9 May 2019 15:49:21 +0900 +Subject: [PATCH] client/gtk2: Keep preedit cursor_pos and visible in clearing + preedit text + +Clear the preedit_string but keep the preedit_cursor_pos and +preedit_visible because a time lag could happen, firefox commit +the preedit text before the preedit text is cleared and it cause +a double commits of the Hangul preedit in firefox if the preedit +would be located on the URL bar and click on anywhere of firefox +out of the URL bar. +--- + client/gtk2/ibusimcontext.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 264a747a..5e3457ba 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -881,10 +881,18 @@ ibus_im_context_clear_preedit_text (IBusIMContext *ibusimcontext) + ibusimcontext->preedit_mode == IBUS_ENGINE_PREEDIT_COMMIT) { + preedit_string = g_strdup (ibusimcontext->preedit_string); + } ++ ++ /* Clear the preedit_string but keep the preedit_cursor_pos and ++ * preedit_visible because a time lag could happen, firefox commit ++ * the preedit text before the preedit text is cleared and it cause ++ * a double commits of the Hangul preedit in firefox if the preedit ++ * would be located on the URL bar and click on anywhere of firefox ++ * out of the URL bar. ++ */ + _ibus_context_update_preedit_text_cb (ibusimcontext->ibuscontext, + ibus_text_new_from_string (""), +- 0, +- FALSE, ++ ibusimcontext->preedit_cursor_pos, ++ ibusimcontext->preedit_visible, + IBUS_ENGINE_PREEDIT_CLEAR, + ibusimcontext); + if (preedit_string) { +-- +2.24.1 + +From 25d11f5cfd4c39e53be11a1348da29a61593cc4c Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 11 Dec 2019 16:28:22 +0900 +Subject: [PATCH] client/gtk2: Fix to set use_button_press_event after signals + are connected + +_ibus_context_update_preedit_text_cb() can be called with reset signals +before ibus_im_context_set_client_window() is called. Then +use_button_press_event needs to be set only when the signals are connected. + +BUG=https://github.com/ibus/ibus/issues/1980 +--- + client/gtk2/ibusimcontext.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 5e3457ba..ac5de809 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -1074,8 +1074,9 @@ ibus_im_context_reset (GtkIMContext *context) + /* Commented out ibus_im_context_clear_preedit_text(). + * Hangul needs to receive the reset callback with button press + * but other IMEs should avoid to receive the reset callback +- * so the signal would need to be customized with GtkSetting. +- * IBus uses button-press-event instead. ++ * by themselves. ++ * IBus uses button-press-event instead until GTK is fixed. ++ * https://gitlab.gnome.org/GNOME/gtk/issues/1534 + */ + ibus_input_context_reset (ibusimcontext->ibuscontext); + } +@@ -1657,10 +1658,13 @@ _ibus_context_update_preedit_text_cb (IBusInputContext *ibuscontext, + if (!ibusimcontext->use_button_press_event && + mode == IBUS_ENGINE_PREEDIT_COMMIT) { + #if !GTK_CHECK_VERSION (3, 93, 0) +- if (ibusimcontext->client_window) ++ if (ibusimcontext->client_window) { + _connect_button_press_event (ibusimcontext, TRUE); +-#endif ++ ibusimcontext->use_button_press_event = TRUE; ++ } ++#else + ibusimcontext->use_button_press_event = TRUE; ++#endif + } + + str = text->text; +-- +2.24.1 + +From c662a02bf3b50914c697af12fc152ee97e2df961 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 25 Dec 2019 17:30:56 +0900 +Subject: [PATCH] client/gtk2: Fix to connect button-press-event signal + +IBus clients do not connect button-press-event in some conditions +and it will be fixed. + +BUG=https://github.com/ibus/ibus/issues/1980 +--- + client/gtk2/ibusimcontext.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index ac5de809..30585403 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -2,8 +2,8 @@ + /* vim:set et sts=4: */ + /* ibus - The Input Bus + * Copyright (C) 2008-2013 Peng Huang +- * Copyright (C) 2015-2018 Takao Fujiwara +- * Copyright (C) 2008-2018 Red Hat, Inc. ++ * Copyright (C) 2015-2019 Takao Fujiwara ++ * Copyright (C) 2008-2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -73,7 +73,7 @@ struct _IBusIMContext { + GCancellable *cancellable; + GQueue *events_queue; + +- gboolean use_button_press_event; ++ gboolean use_button_press_event; + }; + + struct _IBusIMContextClass { +@@ -1125,6 +1125,10 @@ ibus_im_context_get_preedit_string (GtkIMContext *context, + + + #if !GTK_CHECK_VERSION (3, 93, 0) ++/* Use the button-press-event signal until GtkIMContext always emits the reset ++ * signal. ++ * https://gitlab.gnome.org/GNOME/gtk/merge_requests/460 ++ */ + static gboolean + ibus_im_context_button_press_event_cb (GtkWidget *widget, + GdkEventButton *event, +@@ -1157,11 +1161,13 @@ _connect_button_press_event (IBusIMContext *ibusimcontext, + "button-press-event", + G_CALLBACK (ibus_im_context_button_press_event_cb), + ibusimcontext); ++ ibusimcontext->use_button_press_event = TRUE; + } else { + g_signal_handlers_disconnect_by_func ( + widget, + G_CALLBACK (ibus_im_context_button_press_event_cb), + ibusimcontext); ++ ibusimcontext->use_button_press_event = FALSE; + } + } + } +@@ -1188,7 +1194,7 @@ ibus_im_context_set_client_window (GtkIMContext *context, GdkWindow *client) + if (client != NULL) { + ibusimcontext->client_window = g_object_ref (client); + #if !GTK_CHECK_VERSION (3, 93, 0) +- if (ibusimcontext->use_button_press_event) ++ if (!ibusimcontext->use_button_press_event) + _connect_button_press_event (ibusimcontext, TRUE); + #endif + } +@@ -1655,17 +1661,14 @@ _ibus_context_update_preedit_text_cb (IBusInputContext *ibuscontext, + ibusimcontext->preedit_attrs = NULL; + } + ++#if !GTK_CHECK_VERSION (3, 93, 0) + if (!ibusimcontext->use_button_press_event && + mode == IBUS_ENGINE_PREEDIT_COMMIT) { +-#if !GTK_CHECK_VERSION (3, 93, 0) + if (ibusimcontext->client_window) { + _connect_button_press_event (ibusimcontext, TRUE); +- ibusimcontext->use_button_press_event = TRUE; + } +-#else +- ibusimcontext->use_button_press_event = TRUE; +-#endif + } ++#endif + + str = text->text; + ibusimcontext->preedit_string = g_strdup (str); +-- +2.24.1 + +From ecc3465a585448486b2ce68bcefc11d6aebae755 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 23 Jan 2020 16:13:05 +0900 +Subject: [PATCH] client/gtk2: Fix some format sentences + +--- + client/gtk2/ibusimcontext.c | 23 +++++++++++------------ + 1 file changed, 11 insertions(+), 12 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 30585403..50290c55 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -73,7 +73,9 @@ struct _IBusIMContext { + GCancellable *cancellable; + GQueue *events_queue; + ++#if !GTK_CHECK_VERSION (3, 93, 0) + gboolean use_button_press_event; ++#endif + }; + + struct _IBusIMContextClass { +@@ -137,12 +139,12 @@ static void ibus_im_context_set_surrounding + + /* static methods*/ + static void _ibus_context_update_preedit_text_cb +- (IBusInputContext *ibuscontext, +- IBusText *text, +- gint cursor_pos, +- gboolean visible, +- guint mode, +- IBusIMContext *ibusimcontext); ++ (IBusInputContext *ibuscontext, ++ IBusText *text, ++ gint cursor_pos, ++ gboolean visible, ++ guint mode, ++ IBusIMContext *ibusimcontext); + static void _create_input_context (IBusIMContext *context); + static gboolean _set_cursor_location_internal + (IBusIMContext *context); +@@ -172,7 +174,6 @@ static void _create_fake_input_context (void); + static gboolean _set_content_type (IBusIMContext *context); + + +- + static GType _ibus_type_im_context = 0; + static GtkIMContextClass *parent_class = NULL; + +@@ -313,7 +314,6 @@ _process_key_event_done (GObject *object, + { + IBusInputContext *context = (IBusInputContext *)object; + GdkEventKey *event = (GdkEventKey *) user_data; +- + GError *error = NULL; + gboolean retval = ibus_input_context_process_key_event_async_finish ( + context, +@@ -362,12 +362,10 @@ _process_key_event (IBusInputContext *context, + retval = TRUE; + } + +- if (retval) { ++ if (retval) + event->state |= IBUS_HANDLED_MASK; +- } +- else { ++ else + event->state |= IBUS_IGNORED_MASK; +- } + + return retval; + } +@@ -1508,6 +1506,7 @@ _key_is_modifier (guint keyval) + return FALSE; + } + } ++ + /* Copy from gdk */ + static GdkEventKey * + _create_gdk_event (IBusIMContext *ibusimcontext, +-- +2.24.1 diff --git a/SOURCES/ibus-1750836-server-auth-observer.patch b/SOURCES/ibus-1750836-server-auth-observer.patch new file mode 100644 index 0000000..aa3c78b --- /dev/null +++ b/SOURCES/ibus-1750836-server-auth-observer.patch @@ -0,0 +1,179 @@ +From 3d442dbf936d197aa11ca0a71663c2bc61696151 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 13 Sep 2019 15:59:03 +0900 +Subject: [PATCH] bus: Implement GDBusAuthObserver callback + +ibus uses a GDBusServer with G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS, +and doesn't set a GDBusAuthObserver, which allows anyone who can connect +to its AF_UNIX socket to authenticate and be authorized to send method calls. +It also seems to use an abstract AF_UNIX socket, which does not have +filesystem permissions, so the practical effect might be that a local +attacker can connect to another user's ibus service and make arbitrary +method calls. + +BUGS=rhbz#1717958 +--- + bus/server.c | 89 ++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 73 insertions(+), 16 deletions(-) + +diff --git a/bus/server.c b/bus/server.c +index 3a626230..2439de14 100644 +--- a/bus/server.c ++++ b/bus/server.c +@@ -2,7 +2,8 @@ + /* vim:set et sts=4: */ + /* bus - The Input Bus + * Copyright (C) 2008-2010 Peng Huang +- * Copyright (C) 2008-2010 Red Hat, Inc. ++ * Copyright (C) 2011-2019 Takao Fujiwara ++ * Copyright (C) 2008-2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -70,16 +71,63 @@ _restart_server (void) + } + + /** ++ * bus_allow_mechanism_cb: ++ * @observer: A #GDBusAuthObserver. ++ * @mechanism: The name of the mechanism. ++ * @user_data: always %NULL. ++ * ++ * Check if @mechanism can be used to authenticate the other peer. ++ * Returns: %TRUE if the peer's mechanism is allowed. ++ */ ++static gboolean ++bus_allow_mechanism_cb (GDBusAuthObserver *observer, ++ const gchar *mechanism, ++ G_GNUC_UNUSED gpointer user_data) ++{ ++ if (g_strcmp0 (mechanism, "EXTERNAL") == 0) ++ return TRUE; ++ return FALSE; ++} ++ ++/** ++ * bus_authorize_authenticated_peer_cb: ++ * @observer: A #GDBusAuthObserver. ++ * @stream: A #GIOStream. ++ * @credentials: A #GCredentials. ++ * @user_data: always %NULL. ++ * ++ * Check if a peer who has already authenticated should be authorized. ++ * Returns: %TRUE if the peer's credential is authorized. ++ */ ++static gboolean ++bus_authorize_authenticated_peer_cb (GDBusAuthObserver *observer, ++ GIOStream *stream, ++ GCredentials *credentials, ++ G_GNUC_UNUSED gpointer user_data) ++{ ++ gboolean authorized = FALSE; ++ if (credentials) { ++ GCredentials *own_credentials = g_credentials_new (); ++ if (g_credentials_is_same_user (credentials, own_credentials, NULL)) ++ authorized = TRUE; ++ g_object_unref (own_credentials); ++ } ++ return authorized; ++} ++ ++/** + * bus_new_connection_cb: +- * @user_data: always NULL. +- * @returns: TRUE when the function can handle the connection. ++ * @observer: A #GDBusAuthObserver. ++ * @dbus_connection: A #GDBusconnection. ++ * @user_data: always %NULL. + * + * Handle incoming connections. ++ * Returns: %TRUE when the function can handle the connection. + */ + static gboolean +-bus_new_connection_cb (GDBusServer *server, +- GDBusConnection *dbus_connection, +- gpointer user_data) ++bus_new_connection_cb (GDBusServer *server, ++ GDBusConnection *dbus_connection, ++ G_GNUC_UNUSED gpointer user_data) + { + BusConnection *connection = bus_connection_new (dbus_connection); + bus_dbus_impl_new_connection (dbus, connection); +@@ -94,9 +142,9 @@ bus_new_connection_cb (GDBusServer * + } + + static void +-_server_connect_start_portal_cb (GObject *source_object, +- GAsyncResult *res, +- gpointer user_data) ++_server_connect_start_portal_cb (GObject *source_object, ++ GAsyncResult *res, ++ G_GNUC_UNUSED gpointer user_data) + { + GVariant *result; + GError *error = NULL; +@@ -113,9 +161,9 @@ _server_connect_start_portal_cb (GObject + } + + static void +-bus_acquired_handler (GDBusConnection *connection, +- const gchar *name, +- gpointer user_data) ++bus_acquired_handler (GDBusConnection *connection, ++ const gchar *name, ++ G_GNUC_UNUSED gpointer user_data) + { + g_dbus_connection_call (connection, + IBUS_SERVICE_PORTAL, +@@ -136,22 +184,27 @@ void + bus_server_init (void) + { + GError *error = NULL; ++ GDBusServerFlags flags = G_DBUS_SERVER_FLAGS_NONE; ++ gchar *guid; ++ GDBusAuthObserver *observer; + + dbus = bus_dbus_impl_get_default (); + ibus = bus_ibus_impl_get_default (); + bus_dbus_impl_register_object (dbus, (IBusService *)ibus); + + /* init server */ +- GDBusServerFlags flags = G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; +- gchar *guid = g_dbus_generate_guid (); +- if (!g_str_has_prefix (g_address, "unix:tmpdir=")) { +- g_error ("Your socket address does not have the format unix:tmpdir=$DIR; %s", +- g_address); ++ guid = g_dbus_generate_guid (); ++ observer = g_dbus_auth_observer_new (); ++ if (!g_str_has_prefix (g_address, "unix:tmpdir=") && ++ !g_str_has_prefix (g_address, "unix:path=")) { ++ g_error ("Your socket address does not have the format unix:tmpdir=$DIR " ++ "or unix:path=$FILE; %s", g_address); ++ + } + server = g_dbus_server_new_sync ( + g_address, /* the place where the socket file lives, e.g. /tmp, abstract namespace, etc. */ + flags, guid, +- NULL /* observer */, ++ observer, + NULL /* cancellable */, + &error); + if (server == NULL) { +@@ -161,7 +214,13 @@ bus_server_init (void) + } + g_free (guid); + +- g_signal_connect (server, "new-connection", G_CALLBACK (bus_new_connection_cb), NULL); ++ g_signal_connect (observer, "allow-mechanism", ++ G_CALLBACK (bus_allow_mechanism_cb), NULL); ++ g_signal_connect (observer, "authorize-authenticated-peer", ++ G_CALLBACK (bus_authorize_authenticated_peer_cb), NULL); ++ g_object_unref (observer); ++ g_signal_connect (server, "new-connection", ++ G_CALLBACK (bus_new_connection_cb), NULL); + + g_dbus_server_start (server); + +-- +2.21.0 + diff --git a/SPECS/ibus.spec b/SPECS/ibus.spec index b0eec09..2814f36 100644 --- a/SPECS/ibus.spec +++ b/SPECS/ibus.spec @@ -31,7 +31,7 @@ Name: ibus Version: 1.5.19 -Release: 9%{?dist} +Release: 12%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -43,18 +43,20 @@ Source3: https://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.5.19-2018 # Patch0: %%{name}-HEAD.patch # RHEL 8.0 From upstreamed patches Patch0: %{name}-HEAD.patch -# RHEL 8.2 Bug 1713606 - Fix hangul preedit commit with mouse click -Patch1: %{name}-1713606-hangul-with-mouse.patch # RHEL 8.2 Fix not to assert with wrong compose files -Patch2: %{name}-1470673-emoji-warn-instead-assert.patch +Patch1: %{name}-1470673-emoji-warn-instead-assert.patch # RHEL 8.2 Fix not to assert with 16 candidates -Patch3: %{name}-2076-fix-16-candidates.patch +Patch2: %{name}-2076-fix-16-candidates.patch # RHEL 8.2 Show emoji compose in the top category -Patch4: %{name}-xx-emoji-compose.patch +Patch3: %{name}-xx-emoji-compose.patch # RHEL 8.2 Extract $(datarootdir) in ibus-setup -Patch5: %{name}-xx-setup-env.patch +Patch4: %{name}-xx-setup-env.patch +# RHEL 8.2 CVE 2019-14822 +Patch5: %{name}-1750836-server-auth-observer.patch # RHEL 8.2 Bug 1682157 - Integrate ibus-desktop-testing and test cases Patch6: %{name}-1682157-ci.patch +# RHEL 8.2 Bug 1713606 - Fix hangul preedit commit with mouse click +Patch7: %{name}-1713606-hangul-with-mouse.patch # RHEL 8.0 Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577 Patch100: %{name}-1385349-segv-bus-proxy.patch @@ -73,9 +75,12 @@ BuildRequires: dconf-devel BuildRequires: dbus-x11 BuildRequires: python3-devel BuildRequires: python3-gobject +%if %with_python2 +# http://pkgs.devel.redhat.com/cgit/rpms/GConf2/commit/?h=rhel-8.3.0&id=82fe51c3 # https://bugzilla.gnome.org/show_bug.cgi?id=759334 # Need python2 for gsettings-schema-convert BuildRequires: python2-devel +%endif BuildRequires: vala BuildRequires: vala-devel BuildRequires: vala-tools @@ -281,11 +286,14 @@ cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : zcat %SOURCE3 | tar xfv - # prep test -diff client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c -if test $? -ne 0 ; then - echo "Have to copy ibusimcontext.c into client/gtk3" - abort -fi +for f in ibusimcontext.c ibusim.c +do + diff client/gtk2/$f client/gtk3/$f + if test $? -ne 0 ; then + echo "Have to copy $f into client/gtk3" + abort + fi +done %build #autoreconf -f -i -v @@ -478,6 +486,16 @@ dconf update || : %{_datadir}/installed-tests/ibus %changelog +* Thu Jun 04 2020 Takao Fujiwara - 1.5.19-12 +- Resolves: #1713606 - Fix hangul preedit commit with mouse click +- Update 1682157-ci.patch + +* Thu Jan 09 2020 Takao Fujiwara - 1.5.19-11 +- Resolves: #1750836 - Fix CVE-2019-14822 + +* Thu Dec 12 2019 Takao Fujiwara - 1.5.19-10 +- Resolves: #1750836 - Revert Hangul fix for 8.2 schedule + * Tue Dec 03 2019 Takao Fujiwara - 1.5.19-9 - Resolves: #1682157 - Fix RHEL 8.2 covscan #2