[Rd] Graphic parameters with length zero in grid cause R to crash
Hi, I found in grid package, if the graphic parameters have zero length, R crashes. In the following code, I only tested `grid.rect()` and the `fill` parameter, but I think it should be similar as other grid graphic functions. In `gpar()` function, the graphic parameters are not allowed to have zero length, but we can make them with zero length by first generating a `gpar` object and then subsetting with zero length index, such as follows: ``` > library(grid) > gp = gpar(fill = 1) > grid.rect(gp = gp[integer(0)]) ``` After Executing the code, R crashes with message "Floating point exception: 8?". If I set the value of `fill` to an integer, the following code causes an error with a not informative error message. > library(grid) > gp = gpar(fill = as.integer(1)) > grid.rect(gp = gp[integer(0)]) Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : numerical color values must be >= 0, found -192882464 But sometimes it also causes R to crash. My session info: ``` > sessionInfo() R version 4.0.0 (2020-04-24) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.4 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] colorout_1.2-2 loaded via a namespace (and not attached): [1] compiler_4.0.0? ``` Best regards, Zuguang Gu? [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Graphic parameters with length zero in grid cause R to crash
Reproduced on latest Catalina beta and R 4.0.0 and latest RStudio devel build (it crashes the session). On Tue, May 19, 2020 at 7:39 AM Gu, Zuguang wrote: > > Hi, > > > I found in grid package, if the graphic parameters have zero length, R > crashes. In the > > following code, I only tested `grid.rect()` and the `fill` parameter, but I > think it should > > be similar as other grid graphic functions. > > > In `gpar()` function, the graphic parameters are not allowed to have zero > length, but > we can make them with zero length by first generating a `gpar` object and > then subsetting > with zero length index, such as follows: > > ``` > > library(grid) > > gp = gpar(fill = 1) > > grid.rect(gp = gp[integer(0)]) > ``` > > After Executing the code, R crashes with message "Floating point exception: > 8?". > > If I set the value of `fill` to an integer, the following code causes an > error with a > not informative error message. > > > library(grid) > > gp = gpar(fill = as.integer(1)) > > grid.rect(gp = gp[integer(0)]) > Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, > resolveHJust(x$just, : > numerical color values must be >= 0, found -192882464 > > But sometimes it also causes R to crash. > > > My session info: > > > ``` > > > sessionInfo() > R version 4.0.0 (2020-04-24) > Platform: x86_64-apple-darwin17.0 (64-bit) > Running under: macOS Catalina 10.15.4 > > Matrix products: default > BLAS: > /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib > LAPACK: > /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib > > locale: > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] colorout_1.2-2 > > loaded via a namespace (and not attached): > [1] compiler_4.0.0? > ``` > > > Best regards, > Zuguang Gu? > > > [[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
[Rd] failed check in reg-tests-1b.R
Not certain this is actually a bug, so posting here. I'm on Ubuntu 18.04.4 LTS, building R version 4.0.0. The "configure" and "make" steps are successful, but the "make check" step fails when it gets to this part of ./tests/reg-tests-1b.R: > ## methods() gave two wrong warnings in some cases: > op <- options(warn = 2)# no warning, please! > m1 <- methods(na.omit) ## should give (no warning): > ## > setClass("bla") > setMethod("na.omit", "bla", function(object, ...) "na.omit()") Error: package 'codetools' was installed before R 4.0.0: please re-install it Execution halted It appears to be picking up the older version of codetools from $R_LIBS; if I unset R_LIBS, then it works just fine. So I'm wondering, is it a bug, or is the user's own fault for having R_LIBS set whilst trying to build R? Regards, Ben __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] quantile() type 1 for some ordered factors in R-devel
> Tobias Rockel writes: Thanks for spotting this, and also to Hadley for reporting to me directly. Fixed now with c78501. Best -k > Hi, > In R-devel (2020-05-17 r78478) quantile() type 1 seems to behave a little > bit strange for some ordered factors: > quantile(factor(1:3, ordered = TRUE), 0.5, type = 1) > returns “2” as expected. But > quantile(factor(2:4, ordered = TRUE), 0.5, type = 1) > returns “4” and > quantile(factor(3:5, ordered = TRUE), 0.5, type = 1) > returns “NA”. Furthermore, the function returns “NA” for calls like > quantile(factor(c("a", "b", "c"), ordered = TRUE), 0.5, type = 1) > In R 4.0.0 everything seems fine (return values “2”, “3”, “4”, “b”). If the > vectors are treated as numeric, everything seems to work fine in R-devel, > too. For example > quantile(3:5, 0.5, type = 1) > returns “4” in R-devel and R 4.0.0. > Best regards, > Tobias Rockel > [[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