From 32c1a537da6b28d18faa305ccb77422e0566cc07 Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Sat, 20 Jun 2020 19:10:50 -0500 Subject: [PATCH] irssi: add glib unicode handling patch --- srcpkgs/irssi/patches/glib-2-63.patch | 40 +++++++++++++++++++++++++++ srcpkgs/irssi/template | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/irssi/patches/glib-2-63.patch diff --git a/srcpkgs/irssi/patches/glib-2-63.patch b/srcpkgs/irssi/patches/glib-2-63.patch new file mode 100644 index 0000000000..669b04d9a6 --- /dev/null +++ b/srcpkgs/irssi/patches/glib-2-63.patch @@ -0,0 +1,40 @@ +https://github.com/irssi/irssi/releases/download/1.2.2/glib-2-63.patch + +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 +--- src/fe-text/term-terminfo.c ++++ 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/srcpkgs/irssi/template b/srcpkgs/irssi/template index bf029cbcb4..3d158e728d 100644 --- a/srcpkgs/irssi/template +++ b/srcpkgs/irssi/template @@ -1,7 +1,7 @@ # Template file for 'irssi' pkgname=irssi version=1.2.2 -revision=2 +revision=3 build_style=gnu-configure configure_args="--disable-static --with-proxy --enable-true-color --with-otr" hostmakedepends="pkg-config"