From frederik at ofb.net  Tue May 17 03:40:50 2016
From: frederik at ofb.net (frederik at ofb.net)
Date: Mon, 16 May 2016 18:40:50 -0700
Subject: [Rd] please apply my patches
In-Reply-To: <22325.38166.483959.66610@stat.math.ethz.ch>
	<60FE8C75-28AD-4148-BE6A-7A880C4BBC23@gmail.com>
	<57358A2E.7030305@umu.se>
Message-ID: <20160517014050.GA10985@ofb.net>

Dear R Devel,

Sorry for sending so many emails, but I haven't heard that anyone is
working on the patches I created.

A few weeks ago I wanted to do something to contribute to R because I
use it a lot. I picked the most annoying bugs I could find, and
created two of the simplest patches I could create, but all I've had
in response from the R core team (aside from briefly banning my
Bugzilla account) is a lengthy explanation for why power users don't
use the basic command line interface. I'm grateful to Peter for the
list of tools like ESS that people use to interface with R; but if I
wanted to submit a bug to ESS then I would have sent it to a different
mailing list.

Thank you G?ran for confirming that you experience these bugs. I've
Cc'ed two other users, Chris Smowton and "Terran", who commented on
the Bugzilla bugs. Do you guys want to weigh in on the relative
importance of getting these fixed?

Nobody asked me to describe the patches in more detail, but I'll give
a brief summary in case it helps: One of my patches adds a signal
handler for SIGWINCH (which GNU Readline stopped handling a few years
ago without telling anyone). There is no other use of SIGWINCH in the
R code so I don't think this will cause problems. This makes
terminal-resizing possible. The other one adds some additional cleanup
to popReadline. Now, popReadline is called every time a command is
entered at the prompt, or when R catches SIGINT, to reset the terminal
settings and take control back from Readline. My second patch fixes
incremental-search by amending popReadline to clear the line state as
well. I invite creative suggestions as to how these might lead to
unforeseen trouble for Unix or non-Unix users - what I might have
missed in my testing, etc.

Otherwise, I would appreciate some kind of real input as to what I
should do or who I should contact to get this rolling. We're all short
on time; if we can get this taken care of quickly and efficiently then
we'll have more time left for other stuff.

Thank you,

Frederick


On Fri, May 13, 2016 at 10:02:54AM +0200, G?ran Brostr?m 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:
> > 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:
> > > 
> > > > 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
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> > 
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

On Fri, May 13, 2016 at 10:22:13AM +0200, peter dalgaard 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.
> > 
> > - 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:
> >> 
> >>> 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
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> 
> -- 
> 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
> 

On Fri, May 13, 2016 at 10:49:26AM +0200, Martin Maechler wrote:
> >>>>>   <frederik at ofb.net>
> >>>>>     on Thu, 12 May 2016 15:23:04 -0700 writes:
> 
>     > 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
>     >> 
>     >> 
>     >> 
>     >> 
>     >> 
>     >> 
>     >> 
>     >> 
>     >> 
>



[Rd] please apply my patches
frederik at ofb.net