RHEL code reviews

This commit is contained in:
Takao Fujiwara 2018-10-31 18:02:01 +09:00
parent b0845dabef
commit abd5cc37ab
2 changed files with 212 additions and 1 deletions

View File

@ -710,3 +710,211 @@ index 4ebff8da..01c43b0d 100644
--
2.17.1
From c1b55431c076dfa3fc26a3a998bfcf729e9ba602 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 26 Oct 2018 18:44:35 +0900
Subject: [PATCH] src/tests: Fix make check in Fedora 29
ibus-bus and ibus-compose failed in Fedora 29.
1. In ibus-bus with runtest, ibus-daemon failed to restart in
start_exit_async() because it seems to have conflicting IO with runtest
and ibus-daemon failed to close a file descriptor in _restart_server().
The solution is to add a sleep in start_exit_async().
Also added ibus_get_address() in test_async_apis_finish() to check
if ibus-daemon finished to restart.
2. In ibus-compose, the GTK application could not get the ibus module.
The solution is to export GTK_IM_MODULE=ibus.
3. Added DISABLE_DAEMONIZE_IN_TESTS to get error messages in ibus-daemon.
% make DISABLE_DAEMONIZE_IN_TESTS=1 check
---
bus/Makefile.am | 1 +
src/tests/Makefile.am | 1 +
src/tests/ibus-bus.c | 15 ++++++++++++++-
src/tests/runtest | 24 +++++++++++++++++-------
4 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/bus/Makefile.am b/bus/Makefile.am
index bdae5c92..4383a874 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -124,6 +124,7 @@ TESTS_ENVIRONMENT = \
srcdir=$(srcdir) \
LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \
DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \
+ DISABLE_DAEMONIZE_IN_TESTS="$(DISABLE_DAEMONIZE_IN_TESTS)" \
$(NULL)
LOG_COMPILER = $(top_srcdir)/src/tests/runtest
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index c5fef3c8..e337a59b 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -73,6 +73,7 @@ TESTS_ENVIRONMENT = \
srcdir=$(srcdir) \
LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \
DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \
+ DISABLE_DAEMONIZE_IN_TESTS="$(DISABLE_DAEMONIZE_IN_TESTS)" \
$(NULL)
LOG_COMPILER = $(srcdir)/runtest
diff --git a/src/tests/ibus-bus.c b/src/tests/ibus-bus.c
index 7fa1bc4a..0bf9e612 100644
--- a/src/tests/ibus-bus.c
+++ b/src/tests/ibus-bus.c
@@ -820,6 +820,14 @@ finish_exit_async (GObject *source_object,
static void
start_exit_async (void)
{
+ /* When `./runtest ibus-bus` runs, ibus-daemon sometimes failed to
+ * restart because closing a file descriptor was failed in
+ * bus/server.c:_restart_server() with a following error:
+ * "inotify read(): Bad file descriptor"
+ * Now g_usleep() is added here to write down the buffer and not to
+ * fail to restart ibus-daemon.
+ */
+ g_usleep (G_USEC_PER_SEC);
ibus_bus_exit_async (bus,
TRUE, /* restart */
-1, /* timeout */
@@ -831,6 +839,9 @@ start_exit_async (void)
static gboolean
test_async_apis_finish (gpointer user_data)
{
+ /* INFO: g_warning() causes SEGV with runtest script */
+ if (ibus_get_address () == NULL)
+ g_warning ("ibus-daemon does not restart yet from start_exit_async().");
ibus_quit ();
return FALSE;
}
@@ -906,7 +917,9 @@ call_next_async_function (void)
};
static guint index = 0;
- // Use g_timeout_add to make sure test_async_apis finishes even if async_functions is empty.
+ /* Use g_timeout_add to make sure test_async_apis finishes even if
+ * async_functions is empty.
+ */
if (index >= G_N_ELEMENTS (async_functions))
g_timeout_add (1, test_async_apis_finish, NULL);
else
diff --git a/src/tests/runtest b/src/tests/runtest
index d7f96ea3..ab39e9f2 100755
--- a/src/tests/runtest
+++ b/src/tests/runtest
@@ -22,6 +22,7 @@
: ${builddir:=.}
: ${srcdir:=.}
: ${DISABLE_GUI_TESTS:=''}
+: ${DISABLE_DAEMONIZE_IN_TESTS:=''}
BUS_REQUIRED_TESTS="
ibus-bus
@@ -162,16 +163,25 @@ run_test_case()
export GSETTINGS_SCHEMA_DIR=$PWD
# Start ibus-daemon.
- ../$top_builddir/bus/ibus-daemon \
- --daemonize \
- --cache=none \
- --panel=disable \
- --emoji-extension=disable \
- --config=default \
- --verbose;
+ DAEMON_ARGS='
+ --cache=none
+ --panel=disable
+ --emoji-extension=disable
+ --config=default
+ --verbose
+ '
+ if test x"$DISABLE_DAEMONIZE_IN_TESTS" = x ; then
+ ../$top_builddir/bus/ibus-daemon \
+ $DAEMON_ARGS --daemonize;
+ else
+ ../$top_builddir/bus/ibus-daemon \
+ $DAEMON_ARGS &
+ fi
# Wait until all necessary components are up.
sleep 1
+
+ export GTK_IM_MODULE=ibus
fi
"../$tst" ${1+"$@"}
--
2.17.1
From 3172c3b23faefe76b3b7adfc75f9be34a0fb2e02 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 31 Oct 2018 17:42:38 +0900
Subject: [PATCH] RHEL code reviews
---
src/ibuskeymap.c | 2 +-
src/ibuspanelservice.c | 6 +++++-
src/tests/ibus-keypress.c | 2 +-
util/IMdkit/FrameMgr.c | 1 +
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/ibuskeymap.c b/src/ibuskeymap.c
index 27a56754..5abfb99a 100644
--- a/src/ibuskeymap.c
+++ b/src/ibuskeymap.c
@@ -143,7 +143,7 @@ ibus_keymap_parse_line (gchar *str,
/* Do not assign *p1 to g_ascii_isalpha() directly for the syntax check */
if (i == 0 &&
strncmp (p2, "addupper", sizeof ("addupper") - 1) == 0 &&
- (ch = *p1) && g_ascii_isalpha (ch)) {
+ (ch = *p1) && (ch >= 0) && g_ascii_isalpha (ch)) {
gchar buf[] = "a";
buf[0] = g_ascii_toupper(ch);
keymap[keycode][0] = keymap[keycode][3] = keysym;
diff --git a/src/ibuspanelservice.c b/src/ibuspanelservice.c
index 9d87e19b..984cc890 100644
--- a/src/ibuspanelservice.c
+++ b/src/ibuspanelservice.c
@@ -1615,7 +1615,11 @@ ibus_panel_service_panel_extension_register_keys (IBusPanelService *panel,
va_start (var_args, first_property_name);
do {
keys = va_arg (var_args, IBusProcessKeyEventData *);
- g_return_if_fail (keys != NULL);
+ if (keys == NULL) {
+ va_end (var_args);
+ g_warning ("Failed to va_arg for IBusProcessKeyEventData");
+ return;
+ }
g_variant_builder_init (&child, G_VARIANT_TYPE ("av"));
for (; keys; keys++) {
if (keys->keyval == 0 && keys->keycode == 0 && keys->state == 0)
diff --git a/src/tests/ibus-keypress.c b/src/tests/ibus-keypress.c
index 3486523b..17920226 100644
--- a/src/tests/ibus-keypress.c
+++ b/src/tests/ibus-keypress.c
@@ -173,7 +173,7 @@ set_engine_cb (GObject *object,
IBusBus *bus = IBUS_BUS (object);
GtkWidget *entry = GTK_WIDGET (data);
GdkDisplay *display;
- Display *xdisplay;
+ Display *xdisplay = NULL;
GError *error = NULL;
int i, j;
diff --git a/util/IMdkit/FrameMgr.c b/util/IMdkit/FrameMgr.c
index 084b8810..0e91b78e 100644
--- a/util/IMdkit/FrameMgr.c
+++ b/util/IMdkit/FrameMgr.c
@@ -1414,6 +1414,7 @@ static int FrameInstGetSize (FrameInst fi)
break;
}
/*endswitch*/
+ assert (i >= 0);
i = _FrameInstIncrement (fi->template, i);
}
/*endwhile*/
--
2.17.1

View File

@ -31,7 +31,7 @@
Name: ibus
Version: 1.5.19
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -424,6 +424,9 @@ dconf update || :
%{_datadir}/gtk-doc/html/*
%changelog
* Wed Oct 31 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-7
- RHEL code reviews
* Fri Oct 26 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-6
- dbus-x11 is not required in Fedora 30
- Add Conflicts for Fedora 28