From 60dae705062adbd6e21c163cddba05f14614442cdab2ea741629192bdfce4b62 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 28 Apr 2020 19:07:55 +0000 Subject: [PATCH] Accepting request 798708 from home:ailin_nemui:branches:server:irc - Backport a fix that froze Irssi on GLib >2.62 when typing Ctrl+Space (#1180, #1183) OBS-URL: https://build.opensuse.org/request/show/798708 OBS-URL: https://build.opensuse.org/package/show/server:irc/irssi?expand=0&rev=117 --- glib-2-63.patch | 38 ++++++++++++++++++++++++++++++++++++++ irssi.changes | 6 ++++++ irssi.spec | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 glib-2-63.patch diff --git a/glib-2-63.patch b/glib-2-63.patch new file mode 100644 index 0000000..67ef727 --- /dev/null +++ b/glib-2-63.patch @@ -0,0 +1,38 @@ +From a0544571a80196e5b7705f56e6e2cbcdf7b4d80e Mon Sep 17 00:00:00 2001 +From: ailin-nemui +Date: Thu, 23 Apr 2020 21:45:15 +0200 +Subject: [PATCH] manually handle NUL unicode in g_utf8_get_next_char_validated + +A change in GLib 2.63 broke some assumptions in Irssi that the null-byte +NUL / U+0000 is a valid Unicode character. This would occur when the +user types Ctrl+Space. As a result, the input loop never manages to +process the NUL-byte (and any other user input that follows, ever). + +This patch adds a manual check that properly advances the input loop if +GLib returns -2 (incomplete character) despite the length being positive +and a NUL is in first position. + +Fixes #1180 +https://gitlab.gnome.org/GNOME/glib/-/merge_requests/967 +https://gitlab.gnome.org/GNOME/glib/-/issues/2093 +--- + src/fe-text/term-terminfo.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c +index 5235f72d2..78496a64f 100644 +--- a/src/fe-text/term-terminfo.c ++++ b/src/fe-text/term-terminfo.c +@@ -672,7 +672,11 @@ void term_stop(void) + + static int input_utf8(const unsigned char *buffer, int size, unichar *result) + { +- unichar c = g_utf8_get_char_validated((char *)buffer, size); ++ unichar c = g_utf8_get_char_validated((char *) buffer, size); ++ ++ /* GLib >= 2.63 do not accept Unicode NUL anymore */ ++ if (c == (unichar) -2 && *buffer == 0 && size > 0) ++ c = 0; + + switch (c) { + case (unichar)-1: diff --git a/irssi.changes b/irssi.changes index 8cb305f..6d374da 100644 --- a/irssi.changes +++ b/irssi.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 28 16:33:09 UTC 2020 - Ailin Nemui + +- Backport a fix that froze Irssi on GLib >2.62 when typing + Ctrl+Space (#1180, #1183) + ------------------------------------------------------------------- Thu Aug 29 00:29:56 UTC 2019 - Ailin Nemui diff --git a/irssi.spec b/irssi.spec index af59d57..6c3e253 100644 --- a/irssi.spec +++ b/irssi.spec @@ -31,6 +31,7 @@ Source3: https://github.com/irssi/irssi/releases/download/%{version}/irss # https://sks-keyservers.net/pks/lookup?op=get&search=0x00CCB587DDBEF0E1 Source4: %{name}.keyring Source99: irssi-rpmlintrc +Patch0: https://github.com/ailin-nemui/irssi/commit/glib-2-63.patch # PATCH-FIX-OPENSUSE irssi-0.8.16_missing_prototype_warnings.patch Patch1: irssi-0.8.16_missing_prototype_warnings.patch BuildRequires: glib2-devel @@ -78,6 +79,7 @@ compile plugins for the irssi package. %prep %setup -q +%patch0 -p1 %patch1 %build