Update ibus-desktop-testing-runner for su command

This commit is contained in:
Takao Fujiwara 2020-04-22 20:53:28 +09:00
parent bb97060ecb
commit 5be3a0c89f
3 changed files with 317 additions and 67 deletions

View File

@ -1,61 +0,0 @@
From 0c77da82ea59bdeb0c50683ba6f7f2b92b15901c Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 11 Mar 2020 17:08:37 +0100
Subject: [PATCH] src: Use WAYLAND_DISPLAY on Wayland sessions to make up IBus
socket name
In Wayland sessions, GNOME Shell 3.36 is leveraging 2 X11 Display
connections so one is used to set up all services for a "X11 session"
before user applications connected to the other display might require it.
This allows seamlessly starting Xwayland on demand to X11 user applications.
IBus here belongs to the first described connection, it is started
explicitly on that display by GNOME Shell as it is necessary to set up
ibus-x11 before any other X11 client might want to use it.
However the use of this "secondary" display results in IBus daemon left
unable to talk to applications, as the socket name is dependent on the
DISPLAY envvar and ibus/applications don't agree on its content.
For wayland sessions, make it look for WAYLAND_DISPLAY, as that'll have
the similar "per session bus" behavior that this seems to look after.
Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341
---
src/ibusshare.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 0d50d3f5c..e0ef2ce08 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -100,6 +100,7 @@ ibus_get_socket_path (void)
gchar *display;
gchar *displaynumber = "0";
/* gchar *screennumber = "0"; */
+ gboolean is_wayland = FALSE;
gchar *p;
path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE"));
@@ -108,13 +109,19 @@ ibus_get_socket_path (void)
}
if (_display == NULL) {
- display = g_strdup (g_getenv ("DISPLAY"));
+ display = g_strdup (g_getenv ("WAYLAND_DISPLAY"));
+ if (display)
+ is_wayland = TRUE;
+ else
+ display = g_strdup (g_getenv ("DISPLAY"));
}
else {
display = g_strdup (_display);
}
- if (display) {
+ if (is_wayland) {
+ displaynumber = display;
+ } else if (display) {
p = display;
hostname = display;
for (; *p != ':' && *p != '\0'; p++);

View File

@ -0,0 +1,311 @@
From 7b0d091839a4f1315ba216175fb2787e86f7fa31 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
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 <takao.fujiwara1@gmail.com>
+# Copyright (c) 2018-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
# 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 8ce25208c3f4adfd290a032c6aa739d2b7580eb1 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 12 Mar 2020 16:02:16 +0900
Subject: [PATCH] src: Use WAYLAND_DISPLAY on Wayland sessions to make up
IBus socket name
In Wayland sessions, GNOME Shell 3.36 is leveraging 2 X11 Display
connections so one is used to set up all services for a "X11 session"
before user applications connected to the other display might require it.
This allows seamlessly starting Xwayland on demand to X11 user applications.
IBus here belongs to the first described connection, it is started
explicitly on that display by GNOME Shell as it is necessary to set up
ibus-x11 before any other X11 client might want to use it.
However the use of this "secondary" display results in IBus daemon left
unable to talk to applications, as the socket name is dependent on the
DISPLAY envvar and ibus/applications don't agree on its content.
For wayland sessions, make it look for WAYLAND_DISPLAY, as that'll have
the similar "per session bus" behavior that this seems to look after.
BUG=https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341
---
src/ibusshare.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 0d50d3f5..e0ef2ce0 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -100,6 +100,7 @@ ibus_get_socket_path (void)
gchar *display;
gchar *displaynumber = "0";
/* gchar *screennumber = "0"; */
+ gboolean is_wayland = FALSE;
gchar *p;
path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE"));
@@ -108,13 +109,19 @@ ibus_get_socket_path (void)
}
if (_display == NULL) {
- display = g_strdup (g_getenv ("DISPLAY"));
+ display = g_strdup (g_getenv ("WAYLAND_DISPLAY"));
+ if (display)
+ is_wayland = TRUE;
+ else
+ display = g_strdup (g_getenv ("DISPLAY"));
}
else {
display = g_strdup (_display);
}
- if (display) {
+ if (is_wayland) {
+ displaynumber = display;
+ } else if (display) {
p = display;
hostname = display;
for (; *p != ':' && *p != '\0'; p++);
--
2.24.1
From 5765bfd69fb2ab1174378fbb0d8cac7f2bd2610f Mon Sep 17 00:00:00 2001
From: Changwoo Ryu <cwryu@debian.org>
Date: Wed, 15 Apr 2020 17:43:14 +0900
Subject: [PATCH] client/gtk2: Remove glib_check_version() in gtk immodule
In the gtk2/gtk3 immodule, glib_check_version() is being used to make sure
that the installed glib version is not older than the glib version which ibus
is built with.
But there is no reason why glib version is checked in runtime. Library
compatibility is already being checked more precisely by packaging systems and
linkers.
This version check can break the ibus gtk immodule when used with an older but
compatible version of glib, such as glib 2.62.x which is compatible with
2.64.x.
BUG=https://github.com/ibus/ibus/issues/2200
---
client/gtk2/ibusim.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/client/gtk2/ibusim.c b/client/gtk2/ibusim.c
index bfacd0f0..d70800d3 100644
--- a/client/gtk2/ibusim.c
+++ b/client/gtk2/ibusim.c
@@ -41,9 +41,7 @@ static const GtkIMContextInfo *info_list[] = {
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
- return glib_check_version (GLIB_MAJOR_VERSION,
- GLIB_MINOR_VERSION,
- 0);
+ return null;
}
G_MODULE_EXPORT void
--
2.24.1
From 8da016764cee9616cca4658d1fb311d6b3bfc0df Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
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 <takao.fujiwara1@gmail.com>
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/client/gtk2/ibusim.c b/client/gtk2/ibusim.c
index d70800d3..55609ce7 100644
--- a/client/gtk2/ibusim.c
+++ b/client/gtk2/ibusim.c
@@ -2,7 +2,7 @@
/* vim:set et ts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2008-2010 Red Hat, Inc.
+ * Copyright (C) 2008-2020 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
@@ -41,7 +41,7 @@ static const GtkIMContextInfo *info_list[] = {
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
- return null;
+ return NULL;
}
G_MODULE_EXPORT void
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

View File

@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.22
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -43,12 +43,9 @@ Source0: https://github.com/ibus/%name/releases/download/%{version}/%{nam
Source1: %{name}-xinput
Source2: %{name}.conf.5
# Patch0: %%{name}-HEAD.patch
Patch0: %{name}-HEAD.patch
# Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577
Patch1: %{name}-1385349-segv-bus-proxy.patch
# Fix display selection on GNOME 3.36.0
# https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341
# https://github.com/ibus/ibus/pull/2195
Patch2: 2195.patch
BuildRequires: gettext-devel
BuildRequires: libtool
@ -293,7 +290,7 @@ fi
--enable-install-tests \
%{nil}
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
@ -464,6 +461,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Wed Apr 22 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-5
- Update ibus-desktop-testing-runner for su command
* Wed Mar 11 2020 Adam Williamson <awilliam@redhat.com> - 1.5.22-4
- Update #2195 patch backport (it was revised upstream)