[Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-25 Thread Randy Lai
It seems that the behavior of readLines() in R 3.5 has changed for non-blocking 
pipeline.


Consider the following R script, which reads from STDIN line by line.
```
con <- file("stdin")
open(con, blocking = FALSE)

while (TRUE) {
    txt <- readLines(con, 1)
    if (length(txt) > 0) {
        cat(txt, "\n", file = stdout())
    }
    Sys.sleep(0.1)
}
close(con)

```

In R 3.4.4, it works as expected.

```
(randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
abc
foo
```

In R 3.5, only the first line is printed
```
(randymbpro)-Desktop$ echo "abc\nfoo" | R --slave -f test.R
abc
```

Is this change expected?  If I change `blocking` to `TRUE` above, the above 
code would
work. But I need non-blocking connection in my use case of piping buffer from
another program.

Best,

R 3.5 @ macOS 10.13


Randy


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] embeded R application on Windows prints broken character.

2018-04-26 Thread Randy Lai
The issue was reported to me for https://github.com/randy3k/rtichoke/issues/50
which is a python program which embeds R and provides a interface to R.

With R 3.5, for reason which i don't understand, when I typed `"a"` in the 
console
STDOUT got `"\x02\xff\xfea\x03\xff\xfe"` with the extra escaped characters.

I notice that `\x02\xff\xfe` and `\x03\xff\xfe` are encoding related byte marks.
A clear solution is to filter the escaped characters, but I want to understand 
what
changes are causing it happens. It didn’t happen for R 3.4.


Randy



[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] A recent commit breaks embedded application on Windows

2018-06-17 Thread Randy Lai
A line was added to call `R_SetParams ` in the function `R_SetWin32` 4 days ago.
https://github.com/wch/r-source/blob/2370eca96267e29a69396ef53a52ff5d6f60c65b/src/gnuwin32/system.c#L780
However, `R_SetParams` actually calls `R_SetWin32`.
https://github.com/wch/r-source/blob/30f7698e19fe1d2ce8fe53d85cd6cfad21fc8bb0/src/main/startup.c#L284

So it results in a stack overflow.

Related commit by Luke
https://github.com/wch/r-source/commit/2370eca96267e29a69396ef53a52ff5d6f60c65b#diff-8fa3e687488dfa88a74cb15899cf26e1



signature.asc
Description: Message signed with OpenPGP
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] "utils::file.edit" does not understand "editor" with additional arguments

2018-08-28 Thread Randy Lai
I am using Sublime Text as my editor. If I run `subl -n .Rprofile` in bash, a 
file would be opened in a new window.

Back in R, if I run this

> file.edit(".Rprofile", editor="'subl -n'")
sh: 'subl -n': command not found
Warning message:
error in running command

However, the interesting bit happens when I run

edit(1:10, editor="'subl -n’")

It does open Sublime Text. It seems that `file.edit` and `edit` are behaving 
differently when “editor” has additional arguments.

Randy


signature.asc
Description: Message signed with OpenPGP
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Makevars clean target not in action?

2014-03-23 Thread Randy Lai
Hi, developers

When I run `R CMD INSTALL --clean my_package`, only the .o files and the .so 
file are removed, however, they were deleted not because of the clean target 
defined in Makevars.
The clean target was indeed not executed.

I have the following simple Marvars to show that clean target is not 
functioning.

Makevars
-

all: foo $(SHLIB)

clean: 
rm -f *.o $(SHLIB)
rm -f b

foo:
touch b


After I run ``R CMD INSTALL --clean my_package``, the file `b` is still there.

Any thought?

Best,
Randy
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error: C stack usage is too close to the limit

2014-03-29 Thread Randy Lai
I have similar experience previously. What I done was disabling stack limit 
checking

R_CStackLimit = -1;

and increasing the stack size to .16*1024*1024.

Hope it helps.

Randy

On Mar 28, 2014, at 2:55 PM, Florian Burkart  wrote:

> Hi,
> 
> I have been using my own C++ plugin for a while.
> 
> On a new machine I now keep getting the
> 
> C stack usage is too close to the limit
> 
> error. I played with it and it appears to come after I printed a fixed
> number of text to R via Rprintf (not from the main thread).
> 
> Didn't happen on the old machine. Old version was 2.14. Now on 3.0.3.
> 
> Not sure whats going on.
> 
> Florian
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel