R-devel 带有来自摇杆的消毒剂

JRR*_*JRR 5 r rcpp docker address-sanitizer r-package

我试图安装R与USBAN从devel的ASAN摇杆。按照自述文件我试过:

sudo docker run --rm -ti rocker/r-devel-san
Run Code Online (Sandbox Code Playgroud)

这花了很长时间下载,但最后没问题。然后我安装了sanitizers包来测试 R 是否存在已知错误。

install.package("sanitizers")
Run Code Online (Sandbox Code Playgroud)

我试图得到一个错误

> sanitizers::stackAddressSanitize(42)
[1] 24
> sanitizers::heapAddressSanitize(1)
[1] 0
Run Code Online (Sandbox Code Playgroud)

我没有收到任何错误,所以我猜我用 docker 运行的 R 版本不是用消毒剂支持构建的。或者我只是在某个地方错过了一些东西。这是我第一次使用 docker。

Dir*_*tel 7

确保你开始RD而不是R。然后它按预期对我有用:

> install.packages("sanitizers")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cloud.r-project.org/src/contrib/sanitizers_0.1.0.tar.gz'
Content type 'application/x-gzip' length 3963 bytes
==================================================
downloaded 3963 bytes

* installing *source* package ‘sanitizers’ ...
** package ‘sanitizers’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native  -c heap_address.cpp -o heap_address.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native  -c stack_address.cpp -o stack_address.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o sanitizers.so heap_address.o stack_address.o -L/usr/local/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-sanitizers/00new/sanitizers/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sanitizers)

The downloaded source packages are in
        ‘/tmp/RtmpqpZ0Zg/downloaded_packages’
> sanitizers::stackAddressSanitize(42)
stack_address.cpp:16:32: runtime error: index 142 out of bounds for type 'int [100]'
stack_address.cpp:16:11: runtime error: load of address 0x7fff11a2da88 with insufficient space for an object of type 'int'
0x7fff11a2da88: note: pointer points here
 ff 7f 00 00  00 00 00 00 00 00 00 00  b0 a1 85 ce d0 55 00 00  e3 b1 cb da ed 7f 00 00  78 88 fa cf
              ^ 
[1] 0
> 
Run Code Online (Sandbox Code Playgroud)

简而言之,就像在r-devel容器中一样,您想要的非香草版本RD不是R标准二进制包中的普通香草 R。

  • 在最后附加你想要运行的命令——我通常说“bash”。如果您不指定任何值,则使用默认值,我们可以从此处的底层容器继承“/usr/bin/R”。所以你也可以说“docker run --rm -ti rocker/r-devel-san RD”。 (4认同)