diff --git a/irssi.changes b/irssi.changes index 797311a..f87f9ad 100644 --- a/irssi.changes +++ b/irssi.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jan 29 14:39:45 UTC 2024 - Ailin Nemui + +- add perl-again.patch, workaround for Perl bug that breaks the + Irssi locale and glyph rendering (upstream PR #1510) + ------------------------------------------------------------------- Tue Oct 3 07:45:35 UTC 2023 - Ailin Nemui diff --git a/irssi.spec b/irssi.spec index 73c9c92..315b913 100644 --- a/irssi.spec +++ b/irssi.spec @@ -29,6 +29,7 @@ Source2: irssi.png Source3: https://github.com/irssi/irssi/releases/download/%{version}/irssi-%{version}.tar.xz.asc # https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7EE65E3082A5FB06AC7C368D00CCB587DDBEF0E1 Source4: %{name}.keyring +Patch0: https://codeberg.org/irssi/irssi/releases/download/1.4.5/perl-again.patch BuildRequires: glib2-devel BuildRequires: meson BuildRequires: ncurses-devel @@ -72,6 +73,7 @@ compile plugins for the irssi package. %prep %setup -q +%patch0 -p1 %build %meson \ diff --git a/perl-again.patch b/perl-again.patch new file mode 100644 index 0000000..17ef953 --- /dev/null +++ b/perl-again.patch @@ -0,0 +1,92 @@ +From b6507ad5ee6a813efa1698b7383db2f5e720ca2f Mon Sep 17 00:00:00 2001 +From: ailin-nemui +Date: Sat, 27 Jan 2024 17:42:42 +0000 +Subject: [PATCH] Merge pull request #1510 from ailin-nemui/perl-again + +restore locale if perl breaks it + +(cherry picked from commit 504fd7bc609dfd9daee49f4eb9634338bdba1d81) +--- + src/perl/irssi-core.pl | 7 ------- + src/perl/perl-core.c | 25 +++++++++++++++++++++---- + 2 files changed, 21 insertions(+), 11 deletions(-) + +diff --git a/src/perl/irssi-core.pl b/src/perl/irssi-core.pl +index 0999de9e..46066a38 100644 +--- a/src/perl/irssi-core.pl ++++ b/src/perl/irssi-core.pl +@@ -52,10 +52,3 @@ sub eval_file { + die "cap_sasl has been unloaded from Irssi ".Irssi::version()." because it conflicts with the built-in SASL support. See /help network for configuring SASL or read the ChangeLog for more information."; + } + } +- +-if ( $] >= 5.037005 && $] <= 5.038000 ) { +- # https://github.com/Perl/perl5/issues/21366 +- print STDERR "\e7 \e[A Irssi: applying locale workaround for Perl 5.38.0 \e8"; +- require POSIX; +- POSIX::setlocale(&POSIX::LC_ALL, ""); +-} +diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c +index 24f0218c..c0130612 100644 +--- a/src/perl/perl-core.c ++++ b/src/perl/perl-core.c +@@ -111,27 +111,44 @@ static void xs_init(pTHX) + void perl_scripts_init(void) + { + char *code, *use_code; ++ int broken_perl; + + perl_scripts = NULL; + perl_sources_start(); + perl_signals_start(); + + my_perl = perl_alloc(); ++ broken_perl = wcwidth(160); + perl_construct(my_perl); ++ broken_perl = broken_perl != wcwidth(160); + +- perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args)-1, perl_args, NULL); ++ perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args) - 1, perl_args, NULL); + #if PERL_STATIC_LIBS == 1 + perl_eval_pv("Irssi::Core::->boot_Irssi_Core(0.9);", TRUE); + #endif + +- perl_common_start(); ++ perl_common_start(); + + use_code = perl_get_use_list(); + code = g_strdup_printf(irssi_core_code, PERL_STATIC_LIBS, use_code); + perl_eval_pv(code, TRUE); ++ if (broken_perl) { ++ g_warning("applying locale workaround for Perl %d.%d, see " ++ "https://github.com/Perl/perl5/issues/21366", ++ PERL_REVISION, PERL_VERSION); ++ perl_eval_pv("package Irssi::Core;" ++ /* https://github.com/Perl/perl5/issues/21746 */ ++ "if ( $] == $] )" ++ "{" ++ "require POSIX;" ++ "POSIX::setlocale(&POSIX::LC_ALL, \"\");" ++ "}" ++ "1;", ++ TRUE); ++ } + + g_free(code); +- g_free(use_code); ++ g_free(use_code); + } + + /* Destroy all perl scripts and deinitialize perl interpreter */ +@@ -476,7 +493,7 @@ void perl_core_init(void) + char **argv = perl_args; + + PERL_SYS_INIT3(&argc, &argv, &environ); +- print_script_errors = 1; ++ print_script_errors = 1; + settings_add_str("perl", "perl_use_lib", PERL_USE_LIB); + + /*PL_perl_destruct_level = 1; - this crashes with some people.. */ +-- +2.43.0 +