Skip Menu |

This queue is for tickets about the Term-ReadLine-Gnu CPAN distribution.

Maintainer(s)' notes

When you report a bug, please provide the following information;

- output of
	perl -V
	perl Makefile.PL verbose
	make test TEST_VERBOSE=1
	perl -Mblib t/00checkver.t
	echo $TERM
- terminal emulator which you are using
- compiler which is used to compile the GNU Readline Library (libreadline.a) if you can know.
Read INSTALL in the distribution for more details.

Report information
The Basics
Id: 118371
Status: resolved
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: gregoa [...] cpan.org
Cc: CARNIL [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.35



From: gregoa [...] cpan.org
Subject: libterm-readline-gnu-perl: FTBFS on 64-bit big endian architectures
We have the following bug reported to the Debian package of Term-ReadLine-Gnu (https://bugs.debian.org/840689): It doesn't seem to be a bug in the packaging, so you may want to take a look. Thanks! ------8<-----------8<-----------8<-----------8<-----------8<----- Package: libterm-readline-gnu-perl Version: 1.34-1 Severity: serious Hi, On a rebuild against libreadline7, your package failed to build on big-endian, 64-bit architectures: ok 86 - history_inhibit_expansion_function ok 87 ok 88 ok Use of uninitialized value in string eq at t/readline.t line 119. Use of uninitialized value in string eq at t/readline.t line 119. Full logs at: https://buildd.debian.org/status/package.php?p=libterm-readline-gnu-perl Emilio ------8<-----------8<-----------8<-----------8<-----------8<----- Thanks for considering, gregor herrmann, Debian Perl Group
From: ntyni [...] iki.fi
On Thu Oct 13 17:34:20 2016, GREGOA wrote: Show quoted text
> We have the following bug reported to the Debian package of > Term-ReadLine-Gnu (https://bugs.debian.org/840689):
The problem here is that with readline-7.0, rl_readline_state has changed from int to unsigned long. The int_tbl[] initialization in Gnu.xs coerces this to an int in a way that works on little-endian 64-bit platforms but not big-endian ones. I'm not sure how to best fix this. The attached crude hack makes it work, hope it at least illustrates the problem. Thanks for your work on free software, -- Niko Tyni ntyni@debian.org
Subject: 0001-Hack-to-fix-rl_readline_state-handling-on-BE-64-bit-.patch
From 5324da06646be58e3bbf670658293b364fd1cc35 Mon Sep 17 00:00:00 2001 From: Niko Tyni <ntyni@debian.org> Date: Sun, 16 Oct 2016 14:47:57 +0000 Subject: [PATCH] Hack to fix rl_readline_state handling on BE 64-bit platforms With readline-7.0, rl_readline_state has changed from int to unsigned long. This broke the int_tbl initialization on big-endian 64-bit platforms where the pointer ended up addressing the more significant bits of the variable. --- Gnu.xs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Gnu.xs b/Gnu.xs index 4a3e688..24abc03 100644 --- a/Gnu.xs +++ b/Gnu.xs @@ -29,6 +29,9 @@ extern "C" { #include <readline/readline.h> #include <readline/history.h> +#include <sys/param.h> +#include <stdint.h> + /* * Perl 5.005 requires an ANSI C Compiler. Good news. * But I should still support legacy C compilers now. @@ -535,7 +538,11 @@ static struct int_vars { { &rl_dispatching, 0, 0 }, /* 24 */ { &rl_gnu_readline_p, 0, 1 }, /* 25 */ /* rl_readline_state becomes unsigned long on RL 7.0 */ +#if (RL_READLINE_VERSION >= 0x0700) && (UINTPTR_MAX == 0xffffffffffffffff) && (__BYTE_ORDER == __BIG_ENDIAN) + { (int *)&rl_readline_state+1, 0, 0 }, /* 26 */ +#else { (int *)&rl_readline_state, 0, 0 }, /* 26 */ +#endif { &rl_explicit_arg, 0, 1 }, /* 27 */ { &rl_numeric_arg, 0, 1 }, /* 28 */ { &rl_editing_mode, 0, 1 }, /* 29 */ -- 2.1.4
From: ntyni [...] iki.fi
On Sun Oct 16 10:56:11 2016, ntyni@iki.fi wrote: Show quoted text
> On Thu Oct 13 17:34:20 2016, GREGOA wrote:
> > We have the following bug reported to the Debian package of > > Term-ReadLine-Gnu (https://bugs.debian.org/840689):
> > The problem here is that with readline-7.0, rl_readline_state has > changed from int to unsigned long. The int_tbl[] initialization in > Gnu.xs coerces this to an int in a way that works on little-endian 64- > bit platforms but not big-endian ones.
Forgot to mention: the failing test is # Failed test 'readline_state' # at t/readline.t line 152. where the observed value is 0 instead of the expected 2.
Hi, Thank you for your report, and sorry for my late reply. Show quoted text
> The problem here is that with readline-7.0, rl_readline_state has > changed from int to unsigned long. The int_tbl[] initialization in > Gnu.xs coerces this to an int in a way that works on little-endian 64- > bit platforms but not big-endian ones.
You are right. I made a quick fix for it. I thought no 64bit big-endian platform were very rare and my module would not have chance to be used such platform. But I was wrong. On the next release (probably it will be when new GNU Readline Library being released) I will implement a proper fix which supports long variable truly. Thanks.
On Wed Oct 19 04:13:11 2016, HAYASHI wrote: Show quoted text
> Hi, > > Thank you for your report, and sorry for my late reply. >
> > The problem here is that with readline-7.0, rl_readline_state has > > changed from int to unsigned long. The int_tbl[] initialization in > > Gnu.xs coerces this to an int in a way that works on little-endian > > 64- > > bit platforms but not big-endian ones.
> > You are right. > I made a quick fix for it. > I thought no 64bit big-endian platform were very rare and my module > would not have chance to be used such platform. But I was wrong. > > On the next release (probably it will be when new GNU Readline Library > being released) I will implement a proper fix which supports long > variable truly. > > Thanks.
Hello, Ubuntu is now affected. And instead of taking previously mentioned patch, I did the following. Add ulong flag to the int table, and add ulong condition in the get/set functions; in addition to the existing charp vs pint handingling. Pleasee see attached. Regards, Dimitri.
Subject: cp-rt-118371.patch
Description: Use unsigned long for rl_readline_state with readline 7.0 Author: Dimitri John Ledkov <xnox@ubuntu.com> Bug-Debian: https://bugs.debian.org/840689 Bug-Upstream: https://rt.cpan.org/Public/Bug/Display.html?id=118371 --- a/Gnu.xs +++ b/Gnu.xs @@ -501,59 +501,64 @@ int *var; int charp; int read_only; + int ulong; } int_tbl[] = { - { &rl_point, 0, 0 }, /* 0 */ - { &rl_end, 0, 0 }, /* 1 */ - { &rl_mark, 0, 0 }, /* 2 */ - { &rl_done, 0, 0 }, /* 3 */ - { &rl_pending_input, 0, 0 }, /* 4 */ - - { &rl_completion_query_items, 0, 0 }, /* 5 */ - { &rl_completion_append_character, 0, 0 }, /* 6 */ - { &rl_ignore_completion_duplicates, 0, 0 }, /* 7 */ - { &rl_filename_completion_desired, 0, 0 }, /* 8 */ - { &rl_filename_quoting_desired, 0, 0 }, /* 9 */ - { &rl_inhibit_completion, 0, 0 }, /* 10 */ + { &rl_point, 0, 0, 0}, /* 0 */ + { &rl_end, 0, 0, 0}, /* 1 */ + { &rl_mark, 0, 0, 0}, /* 2 */ + { &rl_done, 0, 0, 0}, /* 3 */ + { &rl_pending_input, 0, 0, 0}, /* 4 */ + + { &rl_completion_query_items, 0, 0, 0}, /* 5 */ + { &rl_completion_append_character, 0, 0, 0}, /* 6 */ + { &rl_ignore_completion_duplicates, 0, 0, 0}, /* 7 */ + { &rl_filename_completion_desired, 0, 0, 0}, /* 8 */ + { &rl_filename_quoting_desired, 0, 0, 0}, /* 9 */ + { &rl_inhibit_completion, 0, 0, 0}, /* 10 */ - { &history_base, 0, 0 }, /* 11 */ - { &history_length, 0, 0 }, /* 12 */ + { &history_base, 0, 0, 0}, /* 11 */ + { &history_length, 0, 0, 0}, /* 12 */ #if (RL_READLINE_VERSION >= 0x0402) - { &history_max_entries, 0, 1 }, /* 13 */ + { &history_max_entries, 0, 1, 0}, /* 13 */ #else /* (RL_READLINE_VERSION < 0x0402) */ - { &max_input_history, 0, 1 }, /* 13 */ + { &max_input_history, 0, 1, 0}, /* 13 */ #endif /* (RL_READLINE_VERSION < 0x0402) */ - { &history_write_timestamps, 0, 0 }, /* 14 */ - { (int *)&history_expansion_char, 1, 0 }, /* 15 */ - { (int *)&history_subst_char, 1, 0 }, /* 16 */ - { (int *)&history_comment_char, 1, 0 }, /* 17 */ - { &history_quotes_inhibit_expansion, 0, 0 }, /* 18 */ - { &rl_erase_empty_line, 0, 0 }, /* 19 */ - { &rl_catch_signals, 0, 0 }, /* 20 */ - { &rl_catch_sigwinch, 0, 0 }, /* 21 */ - { &rl_already_prompted, 0, 0 }, /* 22 */ - { &rl_num_chars_to_read, 0, 0 }, /* 23 */ - { &rl_dispatching, 0, 0 }, /* 24 */ - { &rl_gnu_readline_p, 0, 1 }, /* 25 */ - /* rl_readline_state becomes unsigned long on RL 7.0 */ - { (int *)&rl_readline_state, 0, 0 }, /* 26 */ - { &rl_explicit_arg, 0, 1 }, /* 27 */ - { &rl_numeric_arg, 0, 1 }, /* 28 */ - { &rl_editing_mode, 0, 1 }, /* 29 */ - { &rl_attempted_completion_over, 0, 0 }, /* 30 */ - { &rl_completion_type, 0, 0 }, /* 31 */ - { &rl_readline_version, 0, 1 }, /* 32 */ - { &rl_completion_suppress_append, 0, 0 }, /* 33 */ - { &rl_completion_quote_character, 0, 1 }, /* 34 */ - { &rl_completion_suppress_quote, 0, 0 }, /* 35 */ - { &rl_completion_found_quote, 0, 1 }, /* 36 */ - { &rl_completion_mark_symlink_dirs, 0, 0 }, /* 37 */ - { &rl_prefer_env_winsize, 0, 0 }, /* 38 */ - { &rl_sort_completion_matches, 0, 0 }, /* 39 */ - { &rl_completion_invoking_key, 0, 1 }, /* 40 */ - { &rl_executing_key, 0, 1 }, /* 41 */ - { &rl_key_sequence_length, 0, 1 }, /* 42 */ - { &rl_change_environment, 0, 0 }, /* 43 */ - { &utf8_mode, 0, 0 } /* 44 */ + { &history_write_timestamps, 0, 0, 0}, /* 14 */ + { (int *)&history_expansion_char, 1, 0, 0}, /* 15 */ + { (int *)&history_subst_char, 1, 0, 0}, /* 16 */ + { (int *)&history_comment_char, 1, 0, 0}, /* 17 */ + { &history_quotes_inhibit_expansion, 0, 0, 0}, /* 18 */ + { &rl_erase_empty_line, 0, 0, 0}, /* 19 */ + { &rl_catch_signals, 0, 0, 0}, /* 20 */ + { &rl_catch_sigwinch, 0, 0, 0}, /* 21 */ + { &rl_already_prompted, 0, 0, 0}, /* 22 */ + { &rl_num_chars_to_read, 0, 0, 0}, /* 23 */ + { &rl_dispatching, 0, 0, 0}, /* 24 */ + { &rl_gnu_readline_p, 0, 1, 0}, /* 25 */ +/* rl_readline_state becomes unsigned long on RL 7.0 */ +#if (RL_READLINE_VERSION >= 0x0700) + { (unsigned long *)&rl_readline_state, 0, 0, 1}, /* 26 */ +#else + { (int *)&rl_readline_state, 0, 0, 0}, /* 26 */ +#endif + { &rl_explicit_arg, 0, 1, 0}, /* 27 */ + { &rl_numeric_arg, 0, 1, 0}, /* 28 */ + { &rl_editing_mode, 0, 1, 0}, /* 29 */ + { &rl_attempted_completion_over, 0, 0, 0}, /* 30 */ + { &rl_completion_type, 0, 0, 0}, /* 31 */ + { &rl_readline_version, 0, 1, 0}, /* 32 */ + { &rl_completion_suppress_append, 0, 0, 0}, /* 33 */ + { &rl_completion_quote_character, 0, 1, 0}, /* 34 */ + { &rl_completion_suppress_quote, 0, 0, 0}, /* 35 */ + { &rl_completion_found_quote, 0, 1, 0}, /* 36 */ + { &rl_completion_mark_symlink_dirs, 0, 0, 0}, /* 37 */ + { &rl_prefer_env_winsize, 0, 0, 0}, /* 38 */ + { &rl_sort_completion_matches, 0, 0, 0}, /* 39 */ + { &rl_completion_invoking_key, 0, 1, 0}, /* 40 */ + { &rl_executing_key, 0, 1, 0}, /* 41 */ + { &rl_key_sequence_length, 0, 1, 0}, /* 42 */ + { &rl_change_environment, 0, 0, 0}, /* 43 */ + { &utf8_mode, 0, 0, 0} /* 44 */ }; /* @@ -3198,6 +3203,8 @@ /* set C variable */ if (int_tbl[id].charp) *((char *)(int_tbl[id].var)) = (char)pint; + else if (int_tbl[id].ulong) + *((unsigned long *)(int_tbl[id].var)) = (unsigned long)pint; else *(int_tbl[id].var) = pint; @@ -3216,9 +3223,15 @@ warn("Gnu.xs:_rl_fetch_int: Illegal `id' value: `%d'", id); /* return undef */ } else { - sv_setiv(ST(0), - int_tbl[id].charp ? (int)*((char *)(int_tbl[id].var)) - : *(int_tbl[id].var)); + if (int_tbl[id].charp) + sv_setiv(ST(0), + (int)*((char *)(int_tbl[id].var))); + else if (int_tbl[id].ulong) + sv_setiv(ST(0), + (int)*((unsigned long *)(int_tbl[id].var))); + else + sv_setiv(ST(0), + *(int_tbl[id].var)); } }
Subject: Re: [rt.cpan.org #118371] libterm-readline-gnu-perl: FTBFS on 64-bit big endian architectures
Date: Mon, 31 Oct 2016 19:09:46 +0100
To: Hiroo_HAYASHI via RT <bug-Term-ReadLine-Gnu [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
On Wed, 19 Oct 2016 04:13:11 -0400, Hiroo_HAYASHI via RT wrote: Show quoted text
Show quoted text
> I made a quick fix for it. > I thought no 64bit big-endian platform were very rare and my module > would not have chance to be used such platform. But I was wrong. > > On the next release (probably it will be when new GNU Readline > Library being released) I will implement a proper fix which > supports long variable truly.
Could you please (either make a release or) publish your patch? Then Debian and Ubuntu could use the "official" fix right now and wouldn't have to try and come up with homegrown patches. Cheers, gregor, Debian Perl Group -- .''`. Homepage https://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- BOFH excuse #433: error: one bad user found in front of screen
Hi, Thank you for your patch. Give me some time. I'll try to work this week-end. On Mon, 31 Oct 2016 18:09:57 GMT, gregoa@debian.org wrote: Show quoted text
> On Wed, 19 Oct 2016 04:13:11 -0400, Hiroo_HAYASHI via RT wrote: > >
> > I made a quick fix for it. > > I thought no 64bit big-endian platform were very rare and my module > > would not have chance to be used such platform. But I was wrong. > > > > On the next release (probably it will be when new GNU Readline > > Library being released) I will implement a proper fix which > > supports long variable truly.
> > Could you please (either make a release or) publish your patch? Then > Debian and Ubuntu could use the "official" fix right now and wouldn't > have to try and come up with homegrown patches. > > Cheers, > gregor, Debian Perl Group
Subject: Re: [rt.cpan.org #118371] libterm-readline-gnu-perl: FTBFS on 64-bit big endian architectures
Date: Tue, 1 Nov 2016 01:02:57 +0100
To: Hiroo_HAYASHI via RT <bug-Term-ReadLine-Gnu [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
On Mon, 31 Oct 2016 19:01:41 -0400, Hiroo_HAYASHI via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=118371 > > > Give me some time. I'll try to work this week-end.
Sure, take your time. And thanks in advance! Cheers, gregor -- .''`. Homepage https://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Ostbahn-Kurti & Die Chefpartie: Zuckagoschal
Download signature.asc
application/pgp-signature 931b

Message body not shown because it is not plain text.

Hi, I released Term::ReadLine::Gnu-1.35. It includes the fix of this issue. I used the second fix on this ticket with a trivial warning error fix. Thank you so much. This bug causes on a big-endian, sizeof(int)==4, and sizeof(long)==8 platform with the GNU Readline Library 7.0. On the GNU Readline Library 7.0 rl_readline_state is changed from int to unsigned long. But it still holds 32bit values. The fix will be broken when the variable holds more than 32bit values. I looked for a fix supporting 64bit values, but it seems that there is no simple and portable way to support 64bit value on the Perl side (http://stackoverflow.com/questions/31490111/using-64-bits-integers-with-perl-xs). So I decided to apply the proposed fix for a while. Thanks.
Subject: Re: [rt.cpan.org #118371] libterm-readline-gnu-perl: FTBFS on 64-bit big endian architectures
Date: Fri, 4 Nov 2016 00:18:03 +0100
To: Hiroo_HAYASHI via RT <bug-Term-ReadLine-Gnu [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
On Thu, 03 Nov 2016 19:09:51 -0400, Hiroo_HAYASHI via RT wrote: Show quoted text
Show quoted text
> I released Term::ReadLine::Gnu-1.35. It includes the fix of this issue.
Thank you! And thanks to Salvatore, it's already uploaded to Debian, and it built successfully everywhere: https://buildd.debian.org/status/package.php?p=libterm%2dreadline%2dgnu%2dperl Cheers, gregor -- .''`. https://info.comodo.priv.at/ - Debian Developer https://www.debian.org : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06 `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Willi Resetarits + Stubnblues: noan wia mia
Download signature.asc
application/pgp-signature 931b

Message body not shown because it is not plain text.