MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #3293] Shift-Return causes segfault #1791

Closed MichaelChirico closed 4 years ago

MichaelChirico commented 4 years ago

From: Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Full_Name: Graeme Ambler Version: 1.7.1 OS: Red Hat Linux 9 Submission from: (NULL) (137.222.80.161)

Typing Shift-Return in R causes a segmentation fault. I am using the Red Hat 9 RPM from CRAN.


METADATA

MichaelChirico commented 4 years ago

From: Marc Schwartz <MSchwartz@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On Thu, 2003-06-19 at 05:58, Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> wrote:

Full_Name: Graeme Ambler
Version: 1.7.1
OS: Red Hat Linux 9
Submission from: (NULL) (137.222.80.161)

Typing Shift-Return in R causes a segmentation fault.  I am using the
Red Hat 9
RPM from CRAN.

I am unable to replicate this under RH 9 using either the R 1.7.1 RPM or from compiled source code after clean installs of both this morning.

You might want to ensure that you have a clean install of R.

I would first remove all copies of R on your system. Check to see what RPMs are installed by using:

rpm -qa | grep R

to locate the installed R RPM. For 1.7.1 it should only list R-1.7.1-1. So to remove it, as root, use:

rpm -e R-1.7.1-1

Then use:

whereis R

to locate any remaining R binaries and related files, which will typically be in one or more of the following:

/usr/bin/R /usr/lib/R /usr/local/lib/R /usr/local/bin/R

Remove these files and directory trees if they exist.

Once you have completely removed any existing copies of R, then reinstall the RPM using:

rpm -Uvh R-1.7.1-1.i386.rpm

and re-test.

You might also want to verify the MD5 signature on your downloaded copy of the RPM with the value that Martyn has on CRAN just to be sure that there is no corruption of the RPM.

HTH,

Marc Schwartz


METADATA

MichaelChirico commented 4 years ago

From: Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Marc Schwartz <MSchwartz@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> writes:

On Thu, 2003-06-19 at 05:58, Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> wrote:
> Full_Name: Graeme Ambler
> Version: 1.7.1
> OS: Red Hat Linux 9
> Submission from: (NULL) (137.222.80.161)
> 
> 
> Typing Shift-Return in R causes a segmentation fault.  I am using the
> Red Hat 9
> RPM from CRAN.

I am unable to replicate this under RH 9 using either the R 1.7.1 RPM or
from compiled source code after clean installs of both this morning.

You might want to ensure that you have a clean install of R.

Also, I'm a bit confused as to how shift-Return should send anything different that an ordinary Return to R. Which terminal emulator are we talking about??

-- O_ ---- Peter Dalgaard Blegdamsvej 3
c/ /'
--- Dept. of Biostatistics 2200 Cph. N
<CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: Graeme Ambler <Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Hi all,

I don't read this list, so if anyone wants to respond could they please copy me so that I see what is happening.

After several exchanges between myself, Marc Schwartz and Peter Dalgaard, we have come to the following conclusions:

a) Shift-Return does not cause a segfault on most terminals, only Kde's Konsole.

b) The bug is easily reproducable there.

c) The "real" bug is that the control sequence Meta-Shift-O followed by any character causes a segfault on every terminal type we have access to.

d) For some reason, Kde's Konsole interprets Shift-Return as "Meta-Shift-O Shift-M", which is the source of the original bug report.

e) The most helpful error message we can generate is:

Program received signal SIGSEGV, Segmentation fault. 0x400dd7fe in _rl_dispatch_subseq () from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so.4

implying that there is some strange interaction going on with readline, and that the bug may be in readline rather than R.

f) The bug does not seem to be present in R-1.6.2, though this is only my experience, not anyone elses. Peter Dalgaard HAS reproduced the bug in R-1.7.0.

I hope this is all clear. If there is anything that is not, please get back to me and I will attempt to clarify what I meant!

Graeme.


METADATA

MichaelChirico commented 4 years ago

From: Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> writes:

e) The most helpful error message we can generate is:

Program received signal SIGSEGV, Segmentation fault.
0x400dd7fe in _rl_dispatch_subseq ()
from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so.4

implying that there is some strange interaction going on with readline, and 
that the bug may be in readline rather than R.

f) The bug does not seem to be present in R-1.6.2, though this is only my 
experience, not anyone elses.  Peter Dalgaard HAS reproduced the bug in 
R-1.7.0.

..and I just now found a SuSE machine still running 1.6.0 which is also immune to the problem.

-- O_ ---- Peter Dalgaard Blegdamsvej 3
c/ /'
--- Dept. of Biostatistics 2200 Cph. N
<CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: "John W. Eaton" <jwe@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On 27-Jun-2003, Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> wrote:

Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> writes:
> e) The most helpful error message we can generate is:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x400dd7fe in _rl_dispatch_subseq ()
> from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so.4
>
> implying that there is some strange interaction going on with readline, and
> that the bug may be in readline rather than R.
>
> f) The bug does not seem to be present in R-1.6.2, though this is only my
> experience, not anyone elses. Peter Dalgaard HAS reproduced the bug in
> R-1.7.0.
..and I just now found a SuSE machine still running 1.6.0 which is
also immune to the problem.

What version of readline is linked to R 1.6.0 on that system?

The function _rl_dispatch_subseq is apparently new in readline 4.3.

When I link my copy of R (1.7.0-2.cran.3 from the Debian package) with a copy of libreadline-4.3 (built from source obtained from ftp.gnu.org) and enter M-Shift-O at the prompt, it goes into an infinite loop:

export R_HOME=/usr/lib/R LD_LIBRARY_PATH=/usr/local/readline/lib:${R_HOME}/bin:/usr/lib/gcc-lib/i386-linux/3.2.3:/usr/lib/gcc-lib/i386-linux/3.2.3/../../..:${R_HOME}/bin:/usr/X11R6/lib:/usr/lib:/usr/lib:/usr/X11R6/lib gdb ${R_HOME}/bin/R.bin GNU gdb 5.3-debian Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-linux"...(no debugging symbols found)... (gdb) r Starting program: /usr/lib/R/bin/R.bin (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...

R : Copyright 2003, The R Development Core Team Version 1.7.0 (2003-04-16)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type license()' orlicence()' for distribution details.

R is a collaborative project with many contributors. Type `contributors()' for more information.

Type demo()' for some demos,help()' for on-line help, or help.start()' for a HTML browser interface to help. Typeq()' to quit R.

<wait a second or two, then interrupt with Control-C> Program received signal SIGINT, Interrupt. 0x4031a691 in _rl_dispatch (key=256, map=0x8e53a30) at ../readline.c:528 528 { (gdb) Quit (gdb) where

0 0x4031a691 in _rl_dispatch (key=256, map=0x8e53a30) at ../readline.c:528

1 0x4031a851 in _rl_dispatch_subseq (key=256, map=0x8e53a30, got_subseq=0) at ../readline.c:570

2 0x4031a6ae in _rl_dispatch (key=256, map=0x8e53a30) at ../readline.c:529

3 0x4031a851 in _rl_dispatch_subseq (key=256, map=0x8e53a30, got_subseq=0) at ../readline.c:570

... ... ...

(letting it run for a second or so generates thousands of these calls).

Making the following change in readline.c seems to avoid the infinite loop, but I don't know whether it is the correct fix.

--- readline-4.3/readline.∼ 2002-03-13 16:10:46.000000000 -0600 +++ readline-4.3/readline.c 2003-06-27 12:29:50.000000000 -0500 @@ -567,7 +567,7 @@ { / Special case rl_do_lowercase_version (). / if (func == rl_do_lowercase_version)

jwe


METADATA

MichaelChirico commented 4 years ago

From: Graeme Ambler <Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On Friday 27 Jun 2003 18:36, John W. Eaton wrote:

On 27-Jun-2003, Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> wrote:
| Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> writes:
| > e) The most helpful error message we can generate is:
| >
| > Program received signal SIGSEGV, Segmentation fault.
| > 0x400dd7fe in _rl_dispatch_subseq ()
| >    from
| > /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so.4
| >
| > implying that there is some strange interaction going on with readline,
| > and that the bug may be in readline rather than R.
| >
| > f) The bug does not seem to be present in R-1.6.2, though this is only
| > my experience, not anyone elses.  Peter Dalgaard HAS reproduced the bug
| > in R-1.7.0.
|
| ..and I just now found a SuSE machine still running 1.6.0 which is
| also immune to the problem.

What version of readline is linked to R 1.6.0 on that system?

Probably version 4.1 --- I remember in the past always having to install the readline41-4.1-xx package to get R to work. Perhaps Martyn should go back to linking against that in the short term until the bug in readline can be squashed? Or does R-1.7.x need some additional functionality provided by readline-4.3?

Graeme.


METADATA

MichaelChirico commented 4 years ago

From: "John W. Eaton" <jwe@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On 27-Jun-2003, I wrote:

| Making the following change in readline.c seems to avoid the infinite | loop, but I don't know whether it is the correct fix.

It isn't. :-/ There are 5 patches on ftp.gnu.org in the /pub/gnu/readline/readline-4.3-patches. The first one covers this problem:

Bug-Description:

Pressing certain key sequences causes an infinite loop in _rl_dispatch_subseq with the `key' argument set to 256. This eventually causes bash to exceed the stack size limit and crash with a segmentation violation.

Patch:

*** ../readline-4.3/bind.c Thu Jan 24 11:15:52 2002 --- bind.c Wed Jul 31 09:11:18 2002


* 312,316 ** and the function bound to a' to be executed when the user typesabx', leaving bx' in the input queue. */ ! if (k.function /* && k.type == ISFUNC */) { map[ANYOTHERKEY] = k; --- 312,316 ---- and the function bound toa' to be executed when the user types abx', leavingbx' in the input queue. */ ! if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR)) { map[ANYOTHERKEY] = k;

jwe


METADATA

MichaelChirico commented 4 years ago

From: Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Graeme Ambler <Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> writes:

> What version of readline is linked to R 1.6.0 on that system?
Probably version 4.1 --- I remember in the past always having to install the 
readline41-4.1-xx package to get R to work.  Perhaps Martyn should go back to 
linking against that in the short term until the bug in readline can be 
squashed?  Or does R-1.7.x need some additional functionality provided by 
readline-4.3?

Probably not, but it would be a pain to get RH8 users to install the readline41 stuff (does it exist in RPM form on that platform)?

However, it should work to add the line

    "\M-OM":accept-line

to your∼/.inputrc file. That should make the KDE shift-Return sequence work like an ordinary Return.

-- O_ ---- Peter Dalgaard Blegdamsvej 3
c/ /'
--- Dept. of Biostatistics 2200 Cph. N
<CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: Graeme Ambler <Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> I've just rebuilt an rpm from the RedHat SRPM and the patches from ftp.gnu.org and R no longer crashes in any of the cases I have previously described. I can let anyone who wants have a copy of the modified rpms for both RH8 and RH9. The patch numbers are incremented one from the originals, so they should update cleanly on any system.

I guess you can probably close this bug now. It's a bit annoying that RH didn't apply the patches themselves for RH9, since the relevant one came out about 6 months before RH9 was released!

Graeme.

On Friday 27 Jun 2003 19:06, John W. Eaton wrote:

On 27-Jun-2003, I wrote:
| Making the following change in readline.c seems to avoid the infinite
| loop, but I don't know whether it is the correct fix.

It isn't.  :-/  There are 5 patches on ftp.gnu.org in the
/pub/gnu/readline/readline-4.3-patches.  The first one covers this
problem:

Bug-Description:

Pressing certain key sequences causes an infinite loop in
_rl_dispatch_subseq with the `key' argument set to 256.  This eventually
causes bash to exceed the stack size limit and crash with a segmentation
violation.

Patch:

*** ../readline-4.3/bind.c    Thu Jan 24 11:15:52 2002
--- bind.c    Wed Jul 31 09:11:18 2002
***************
*** 312,316 ****
and the function bound  to `a' to be executed when the user
types `abx', leaving `bx' in the input queue. */
!       if (k.function /* && k.type == ISFUNC */)
{
map[ANYOTHERKEY] = k;
--- 312,316 ----
and the function bound  to `a' to be executed when the user
types `abx', leaving `bx' in the input queue. */
!       if (k.function && ((k.type == ISFUNC && k.function !=
rl_do_lowercase_version) || k.type == ISMACR)) {
map[ANYOTHERKEY] = k;

jwe

METADATA

MichaelChirico commented 4 years ago

From: Peter Dalgaard BSA <p.dalgaard@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> writes:

I've just rebuilt an rpm from the RedHat SRPM and the patches from
ftp.gnu.org 
and R no longer crashes in any of the cases I have previously described.  I 
can let anyone who wants have a copy of the modified rpms for both RH8 and 
RH9.  The patch numbers are incremented one from the originals, so they 
should update cleanly on any system.

I guess you can probably close this bug now.  It's a bit annoying that RH 
didn't apply the patches themselves for RH9, since the relevant one came out 
about 6 months before RH9 was released!

Has anyone filed a bug report with RedHat on this?

-- O_ ---- Peter Dalgaard Blegdamsvej 3
c/ /'
--- Dept. of Biostatistics 2200 Cph. N
<CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: Marc Schwartz <MSchwartz@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On Sat, 2003-06-28 at 04:53, Peter Dalgaard BSA wrote:

Graeme.Ambler@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> writes:

> I've just rebuilt an rpm from the RedHat SRPM and the patches from
ftp.gnu.org
> and R no longer crashes in any of the cases I have previously described.  I 
> can let anyone who wants have a copy of the modified rpms for both RH8 and 
> RH9.  The patch numbers are incremented one from the originals, so they 
> should update cleanly on any system.
> 
> I guess you can probably close this bug now.  It's a bit annoying that RH 
> didn't apply the patches themselves for RH9, since the relevant one came
out 
> about 6 months before RH9 was released!

Has anyone filed a bug report with RedHat on this?

I just did.

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=98229

As Graeme has stated, the patches are available and this and other readline related bugs have been reported previously to RH's Bugzilla and were closed, based upon my search this morning. I am unclear as to why this seems to be happening yet again, other than RH neglected to include the patches in the last update.

In checking RH's dates for the readline RPM updates, version 4.3-5 was made available back in January, so this particular bug's patch and one other were available prior to that, however the three other patches that are listed are after that date. The five patches are listed at ftp://ftp.gnu.org/gnu/readline/readline-4.3-patches.

So it would seem that RH is long overdue in issuing an updated readline RPM.

Regards,

Marc Schwartz


METADATA

MichaelChirico commented 4 years ago

NOTES: Appears to be bug in readline as shipped by RH


METADATA

MichaelChirico commented 4 years ago

Audit (from Jitterbug): Fri Jul 4 11:45:08 2003 ripley changed notes Fri Jul 4 11:45:08 2003 ripley foobar Fri Jul 4 11:45:08 2003 ripley moved from incoming to System-specific-fixed


METADATA