Skip to content

unix readline signal handling patches

8 messages · frederik at ofb.net, Göran Broström, Peter Dalgaard +1 more

7 days later
#
Dear R Developers,

I wrote to this list a week ago with some patches that fix bugs in R's
GNU Readline interface, but I haven't had a reply. I'm not in a hurry
but I'd like to make sure that my message is getting read by the right
people. Should I be sending my patches somewhere else?

Thank you,

Frederick
#
> Dear R Developers,
    > I wrote to this list a week ago with some patches that fix bugs in R's
    > GNU Readline interface, but I haven't had a reply. I'm not in a hurry
    > but I'd like to make sure that my message is getting read by the right
    > people. Should I be sending my patches somewhere else?

Thank you Frederick for your reports and patches.
You did send them to the correct place, https://bugs.r-project.org/

Sometimes (as here) a combination of circumstances do lead to
nobody picking them up quickly.
In this case,

- probably none of R-core use or even have easy access to Arch Linux
  so we cannot easily veryify that there is a bug at all
  nor -consequently- veryify that your patch does fix the bug.

- no other user has confirmed the bug on his/her platform, so
  there did not seem a huge demand...

- Accidentally many in R core may be busy with other bugs, teaching, .....
  and just lack the extra resources to delve into these problems
  at the current moment.

Hence, there was not even an 'Acknowledged' change to your
reports--indeed as nobody had been able to see there is a problem
existing outside of your personal computer.

I agree that this must seem a bit frustrating to you.

--
Martin
#
Actually, the bugs look like they should apply fairly generally, just maybe not bothering all that many people. But there could be portability issues with the fixes, so I suspect some of us were waiting for "a readline expert" to check them out.

-pd

BTW: Anyone with a fix for the stuck-at-eol issue? (aaa<right>bbb<left>ccc)

  
    
#
Hi Peter, Martin, and others,

Thanks for your replies.

- The bugs apply to all systems that use GNU Readline, not just Linux
  or Arch Linux.

- Readline version 6.3 changed the signal handling so that SIGWINCH is
  no longer handled automatically by the library. This means it's not
  currently possible for people using R on e.g. Linux to resize the
  terminal, or at least when they do so they have to make sure that
  all their commands fit in one line and don't wrap.

- There is also a long-standing bug in Readline where the callback
  interface didn't properly clear the line on SIGINT (^C). This means
  that "exiting" reverse-incremental-search with ^C would give an
  apparently empty prompt which still had some pending input, so if
  you hit ^C-Return then an unintended command would get executed.

If they're not "bothering all that many people", then perhaps it's
because everyone uses Windows or Mac OS X or RStudio. For me these are
pretty significant bugs. The second one causes unintended code to be
executed. Random code could delete files, for example, or worse. The
first one bites me every time I want to change the size of a window,
which is pretty often.

I tried to get Readline maintainer Chet Ramey to fix these on the
Readline side, but he disagreed with my proposal:

https://lists.gnu.org/archive/html/bug-readline/2016-04/threads.html

I'm glad that my message here at least was seen and I hope that
someone who uses the R command line on Linux will have time to verify
that the patches work correctly. They are basically Chet-approved
workarounds for bugs/changes in Readline, not very complicated.

Do either of you know a Linux R person you could ping to get these
patches checked out? I'm not overly frustrated, and I'm not in a major
hurry, but from what we've observed it seems like waiting for someone
concerned to come along and finally read Bugzilla or the R-Devel
archives is not going to result in a very dense Poisson process...

Thanks,

Frederick Eaton
On Thu, May 12, 2016 at 03:42:59PM +0200, peter dalgaard wrote:
#
Dear Frederik,

I can confirm that especially the first issue on your list (resizing the 
terminal) has "bothered me" badly for some time now: I'm on Ubuntu 
(usually).

G?ran Brostr?m
On 2016-05-13 00:23, frederik at ofb.net wrote:
#
Actually, I think both Martin and I use reaadline R versions on a daily basis (Linux and OSX Terminal respectively). For my case, it is just that I rarely use the backwards search feature and I'm old enough that terminal widths other than 80 look odd to me so I don't resize much either. Of course that doesn't mean that the bugs aren't annoying to others!

-pd
On 13 May 2016, at 00:23 , frederik at ofb.net wrote:

            

  
    
#
> Hi Peter, Martin, and others,
    > Thanks for your replies.

    > - The bugs apply to all systems that use GNU Readline, not just Linux
    > or Arch Linux.

yes... but

    > - Readline version 6.3 changed the signal handling so that SIGWINCH is
    > no longer handled automatically by the library. This means it's not
    > currently possible for people using R on e.g. Linux to resize the
    > terminal, or at least when they do so they have to make sure that
    > all their commands fit in one line and don't wrap.

    > - There is also a long-standing bug in Readline where the callback
    > interface didn't properly clear the line on SIGINT (^C). This means
    > that "exiting" reverse-incremental-search with ^C would give an
    > apparently empty prompt which still had some pending input, so if
    > you hit ^C-Return then an unintended command would get executed.

    > If they're not "bothering all that many people", then perhaps it's
    > because everyone uses Windows or Mac OS X or RStudio 

or  ESS [ := Emacs Speaks Statistics]  https://ess.r-project.org/ ),
really the first cross platform UI, and the most used one by R 
"gurus" for a long time...

or StatET (an Eclipse based GUI, also cross platform)

or ... {quite a few more}.

I'm pretty sure (but may be wrong) that 99% of useRs do not work
much with R in a readline-enabled console, but rather via
another interface.
Maybe only 95% if you restrict yourself to non-Mac, non-Windows
(i.e. typically Linux) users. 

    > For me these are pretty significant bugs. 

I agree they should be fixed.. only just because regular bash
users may like the readline-enabled R in a terminal, and because
readline is nice in itself, and it'd be a pity if our using it
started to lag. ... or has started to lag, as you found..


    > The second one causes unintended code to be
    > executed. Random code could delete files, for example, or worse. The
    > first one bites me every time I want to change the size of a window,
    > which is pretty often.

    > I tried to get Readline maintainer Chet Ramey to fix these on the
    > Readline side, but he disagreed with my proposal:

    > https://lists.gnu.org/archive/html/bug-readline/2016-04/threads.html

    > I'm glad that my message here at least was seen and I hope that
    > someone who uses the R command line on Linux will have time to verify
    > that the patches work correctly. They are basically Chet-approved
    > workarounds for bugs/changes in Readline, not very complicated.

    > Do either of you know a Linux R person you could ping to get these
    > patches checked out? I'm not overly frustrated, and I'm not in a major
    > hurry, but from what we've observed it seems like waiting for someone
    > concerned to come along and finally read Bugzilla or the R-Devel
    > archives is not going to result in a very dense Poisson process...

Well, many of us from R core use Linux regularly or at least occasionally and
hence can take time to confirm the bug ... and if the patch
seems to fix it.

However, most of experienced R users, not just R core,
"believes" in reproducibility and hence we want to work with *.R
scripts (or *.Rmd etc nowadays):

We had a saying in the ESS manuals for 20 years or so:

   "The source code is real."

which had later been extended to

    "The source code is real.
     The objects are realizations of the source code."

As a consequence, we do not "work" in the R console; we may tinker
a bit for experiments, but we really work "in" the R source files.

For that reason, if apply your patches and quickly check that
the previous bug seems gone, I would not notice if the patch had
introduced new bugs ... just because I almost never work in
"readline-R"  but always (99.9%) work in Linux.

Martin


    > Thanks,
    > Frederick Eaton
> On Thu, May 12, 2016 at 03:42:59PM +0200, peter dalgaard wrote:
>>
>> > On 12 May 2016, at 10:03 , Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>> > 
    >> >>>>>>  <frederik at ofb.net>
    >> >>>>>>    on Wed, 11 May 2016 23:00:20 -0700 writes:
    >> > 
    >> >> Dear R Developers,
    >> >> I wrote to this list a week ago with some patches that fix bugs in R's
    >> >> GNU Readline interface, but I haven't had a reply. I'm not in a hurry
    >> >> but I'd like to make sure that my message is getting read by the right
    >> >> people. Should I be sending my patches somewhere else?
    >> > 
    >> > Thank you Frederick for your reports and patches.
    >> > You did send them to the correct place, https://bugs.r-project.org/
    >> > 
    >> > Sometimes (as here) a combination of circumstances do lead to
    >> > nobody picking them up quickly.
    >> > In this case,
    >> > 
    >> > - probably none of R-core use or even have easy access to Arch Linux
    >> >  so we cannot easily veryify that there is a bug at all
    >> >  nor -consequently- veryify that your patch does fix the bug.
    >> 
    >> Actually, the bugs look like they should apply fairly generally, just maybe not bothering all that many people. But there could be portability issues with the fixes, so I suspect some of us were waiting for "a readline expert" to check them out.
    >> 
    >> -pd
    >> 
    >> BTW: Anyone with a fix for the stuck-at-eol issue? (aaa<right>bbb<left>ccc) 
    >> 
    >> > 
    >> > - no other user has confirmed the bug on his/her platform, so
    >> >  there did not seem a huge demand...
    >> > 
    >> > - Accidentally many in R core may be busy with other bugs, teaching, .....
    >> >  and just lack the extra resources to delve into these problems
    >> >  at the current moment.
    >> > 
    >> > Hence, there was not even an 'Acknowledged' change to your
    >> > reports--indeed as nobody had been able to see there is a problem
    >> > existing outside of your personal computer.
    >> > 
    >> > I agree that this must seem a bit frustrating to you.
    >> > 
    >> > --
    >> > Martin
    >> > 
    >> > ______________________________________________
    >> > R-devel at r-project.org mailing list
    >> > https://stat.ethz.ch/mailman/listinfo/r-devel
    >> 
    >> -- 
    >> Peter Dalgaard, Professor,
    >> Center for Statistics, Copenhagen Business School
    >> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
    >> Phone: (+45)38153501
    >> Office: A 4.23
    >> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
    >> 
    >> 
    >> 
    >> 
    >> 
    >> 
    >> 
    >> 
    >>