Re: [R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

2021-11-12 Thread Gábor Csárdi
Thanks for the answer, I actually just saw this today, it went into my
spam folder for some reason.

Anyway, I tried to build readline 5.2 and it wasn't that bad. I got
the source for the libreadline-gplv2-dev Debian package
(https://packages.debian.org/stretch/libreadline-gplv2-dev). This is
readline 5.2 plus some readline patches and some more Debian patches.
It is easiest to do this in Debian, where `apt-get source` applies the
patches automatically. I used Debian Buster. After that I only had to
add two

#include 

lines to terminal.c and rltty.c.

I put the patched tarball here if you don't want to patch it yourself:
https://files.r-hub.io/readline/ I did build R-devel against it, and
it seems to work great.

In summary, this should do it:

curl -O https://files.r-hub.io/readline/readline5-5.2+dfsg-1.tar.gz
tar xzf readline5-5.2+dfsg-1.tar.gz
cd readline5-5.2+dfsg
./configure --prefix=/opt/R/arm64 --enable-static --enable-shared=NO
make
sudo make install

(Some info doc is missing for me, but that does not seem important.)

I am hopeful that this will work out.

Best,
Gabor

On Wed, Nov 3, 2021 at 11:00 PM Simon Urbanek
 wrote:
>
> Gabor,
>
> as you can see the x86_64 readline is a very old build 5.2-14 - it is the 
> last version released under GPL-2. Later versions are to my best knowledge 
> license-incompatible since they are released under GPL-3 only and thus do not 
> allow the use in GPL-2 software. The arm64 version currently relies on the 
> system library which is libedit. If it is of interest I can check if readline 
> 5.2 can be built for arm64, but it predates the architecture by quite a few 
> years ;).
>
> Cheers,
> Simon
>
>
> > On Nov 4, 2021, at 7:12 AM, Gábor Csárdi  wrote:
> >
> > On Wed, Nov 3, 2021 at 7:00 PM Prof Brian Ripley  
> > wrote:
> > [...]
> >> AFAIK the reason for not distributing readline with binary distributions
> >> of R is perceived licence restrictions.
> >
> > So is the license different for x86_64? Because those builds come with 
> > readline:
> > ❯ R-4.1 -q -e 'extSoftVersion()[["readline"]]'
> >> extSoftVersion()[["readline"]]
> > [1] "5.2"
> >
> > Whereas the arm64 build has:
> > ❯ R-4.1-arm64 -q -e 'extSoftVersion()[["readline"]]'
> >> extSoftVersion()[["readline"]]
> > [1] "4.2 (EditLine wrapper)"
> >
> > Gabor
> >
> > ___
> > R-SIG-Mac mailing list
> > R-SIG-Mac@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >
>

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

2021-11-03 Thread Simon Urbanek


Gabor,

as you can see the x86_64 readline is a very old build 5.2-14 - it is the last 
version released under GPL-2. Later versions are to my best knowledge 
license-incompatible since they are released under GPL-3 only and thus do not 
allow the use in GPL-2 software. The arm64 version currently relies on the 
system library which is libedit. If it is of interest I can check if readline 
5.2 can be built for arm64, but it predates the architecture by quite a few 
years ;).

Cheers,
Simon


> On Nov 4, 2021, at 7:12 AM, Gábor Csárdi  wrote:
> 
> On Wed, Nov 3, 2021 at 7:00 PM Prof Brian Ripley  
> wrote:
> [...]
>> AFAIK the reason for not distributing readline with binary distributions
>> of R is perceived licence restrictions.
> 
> So is the license different for x86_64? Because those builds come with 
> readline:
> ❯ R-4.1 -q -e 'extSoftVersion()[["readline"]]'
>> extSoftVersion()[["readline"]]
> [1] "5.2"
> 
> Whereas the arm64 build has:
> ❯ R-4.1-arm64 -q -e 'extSoftVersion()[["readline"]]'
>> extSoftVersion()[["readline"]]
> [1] "4.2 (EditLine wrapper)"
> 
> Gabor
> 
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

2021-11-03 Thread Gábor Csárdi
On Wed, Nov 3, 2021 at 7:00 PM Prof Brian Ripley  wrote:
[...]
> AFAIK the reason for not distributing readline with binary distributions
> of R is perceived licence restrictions.

So is the license different for x86_64? Because those builds come with readline:
❯ R-4.1 -q -e 'extSoftVersion()[["readline"]]'
> extSoftVersion()[["readline"]]
[1] "5.2"

Whereas the arm64 build has:
❯ R-4.1-arm64 -q -e 'extSoftVersion()[["readline"]]'
> extSoftVersion()[["readline"]]
[1] "4.2 (EditLine wrapper)"

Gabor

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

2021-11-03 Thread Prof Brian Ripley

On 03/11/2021 12:21, Gábor Csárdi wrote:

Anyone else noticed some weirdness with the arm build when the prompt
has ANSI escape codes?

E.g. in a terminal run this
options(prompt = "\033[1m> \033[0m")

and then at the new prompt type in some longer word and press CTRL+A.


Longer than what?


The cursor does not go back to the beginning of the line, probably
because the width of the prompt is not calculated correctly by the
underlying system library.

readline is not listed at https://mac.r-project.org/libs-arm64/ while
it is listed among the intel libs. Does that mean that R uses libedit
on arm64? Is this an issue with libedit?


This is why we added extSoftversion(): please use it.

For my personal build of R-patched (which uses readline 8.1) this works 
as I expected.  With the CRAN build of 4.1.2 I do see some weirdness, e.g.


> options(prompt = "\033[1mR> \033[0m")
R> abcdef

where after the Ctrl-A the cursor moves forwards a couple of characters. 
 (That 'R>' is bold will not show up in an email.


All on Monterey 12.0.1.

AFAIK the reason for not distributing readline with binary distributions 
of R is perceived licence restrictions.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

2021-11-03 Thread Gábor Csárdi
Anyone else noticed some weirdness with the arm build when the prompt
has ANSI escape codes?

E.g. in a terminal run this
options(prompt = "\033[1m> \033[0m")

and then at the new prompt type in some longer word and press CTRL+A.
The cursor does not go back to the beginning of the line, probably
because the width of the prompt is not calculated correctly by the
underlying system library.

readline is not listed at https://mac.r-project.org/libs-arm64/ while
it is listed among the intel libs. Does that mean that R uses libedit
on arm64? Is this an issue with libedit?

Thanks,
Gabor

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac