[R-SIG-Mac] R 4.1.2 (arm build) will output for nothing when --interactive flag is passed

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Mon Jan 24 02:35:34 CET 2022


Paul,

thanks, you example is getting closer to the real issue which is that stdin is not treated as input if libedit is used and --interactive is specified:

R 4.1.2 arm64 binary:
$ echo x | R --quiet --no-save --interactive


Current (4.1.2 patched or devel - https://mac.R-project.org) R arm64 binary:
$ echo x | R --quiet --no-save --interactive
> x
Error: object 'x' not found
> 


The main difference is that the binaries are now using libreadline instead of Apple's libedit (see extSoftVersion()["readline"] ). So the short answer is update your R if that matters to you. I have not looked into the cause in libedit, so I don't know if that is a libedit bug or something we do.

Cheers,
Simon



> On Jan 24, 2022, at 11:08 AM, Paul Keydel <paul.keydel using posteo.de> wrote:
> 
> Dear all!
> 
> Thanks for reporting the issue. I observed the same problem, but I messaged not quickly enough...
> In fact, it seems that the ARM build of R (4.1.2) cannot pick up the data piped in when the —interactive flag is set. For reproducing I would suggest to use a simple “print(2.718)” instead of the string below.
> 
> So, here is what I got, just copied from the terminal (macOS 12.1)
> 
> Pauls-Air:~ paul$ echo "print(2.718)" | R --quiet --no-save
>> print(2.718)
> [1] 2.718
>> 
> Pauls-Air:~ paul$ echo "print(2.718)" | R --quiet --no-save --interactive
> 
> Pauls-Air:~ paul$
> 
> The first one gives the expected output, but when I force R to be in interactive mode, R somehow ignores the input from stdin. And we don’t know why :-)
> 
> Thanks for your time and help!
> 
> Best,
> Paul
> 
> 
>> On 23. Jan 2022, at 22:12, Simon Urbanek <simon.urbanek using R-project.org> wrote:
>> 
>> Year,
>> 
>> that code doesn't output anything on stdout, because it is an error so it does show up on stderr:
>> 
>> $ echo "base::cat('Hello\\\\n')\\n" | R --silent --no-save --interactive 
>>> base::cat('Hello\\n')\n
>> Error: unexpected '\\' in "base::cat('Hello\\n')\"
>> 
>> What you probably meant was 
>> 
>> $ echo 'cat("Hello\n")' | R --silent --no-save --interactive 
>>> cat("Hello\n")
>> Hello
>>> 
>> 
>> which works as expected.
>> 
>> Cheers,
>> Simon
>> 
>> 
>> 
>> 
>>> On Jan 23, 2022, at 12:33 PM, YearNorth via R-SIG-Mac <r-sig-mac using r-project.org> wrote:
>>> 
>>> Dear developer:
>>> 
>>> On R 4.1.2 (arm build) in macOS 12.0.1, if call R from shell, when —interactive flag is passed, it will output nothing.
>>> 
>>> To reproduce it:
>>> 
>>> ```
>>> echo "base::cat('Hello\\\\n')\\n" | R --no-save --interactive > test.txt
>>> 
>>> ``
>>> 
>>> doesn’t yield the derised output
>>> 
>>> ```
>>> R version 4.1.2 (2021-11-01) -- "Bird Hippie”
>>> Copyright (C) 2021 The R Foundation for Statistical Computing
>>> Platform: aarch64-apple-darwin20 (64-bit)
>>> 
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>> 
>>> Natural language support but running in an English locale
>>> 
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>> 
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R
>>> 
>>> ```
>>> 
>>> The desired output should have a line `> base::cat('Hello\\n')\n` in test.txt
>>> 
>>> This may be the critical problem for why `vscDebugger` (a R debugger for VSCode) does not work for arm build R.
>>> 
>>> See the discussion on github 
>>> https://github.com/ManuelHentschel/VSCode-R-Debugger/issues/155#issuecomment-1014946738 <https://github.com/ManuelHentschel/VSCode-R-Debugger/issues/155#issuecomment-1014946738>
>>> https://github.com/ManuelHentschel/VSCode-R-Debugger/issues/155#issuecomment-1017250405 <https://github.com/ManuelHentschel/VSCode-R-Debugger/issues/155#issuecomment-1017250405>
>>> 
>>> Thanks for your time reading and processing my email!
>>> 
>>> Best,
>>> North
>>> Year
>>> 	[[alternative HTML version deleted]]
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 



More information about the R-SIG-Mac mailing list