Closed bbolker closed 5 months ago
The confusion has been there for a decade and you are unlucky to not have stumbled over a few issues here, questions and answers at SO, or on the mailing list. For consistency with the other container, ease of comparison and a verified way to get all dependencies into all these container they do install the r-release version as usual and then (and that is documented) build and install RD
and RDscript
as entry points to the modified r-devel versions.
I.e.
edd@rob:~$ docker run --rm -ti rocker/r-devel-san R --version | head -1
R version 4.4.0 (2024-04-24) -- "Puppy Cup"
edd@rob:~$ docker run --rm -ti rocker/r-devel-san RD --version | head -1
R Under development (unstable) (2024-06-03 r86679) -- "Unsuffered Consequences"
edd@rob:~$
Now that I'm looking for it I see the note
(using alias RD)
under r-devel-san
. If you don't mind I might submit a patch or two to the website to repeat this comment, and maybe even amplify it slightly?
Now I'm going down the sanitizers
rabbit hole to try to confirm/test whether sanitization-checking is really turned on, and struggling/surely making some other thinkos. (What is your hourly consulting fee? I'm seriously contemplating paying you for an hour or two to help me over some hurdles ...)
Yes documenting this consistently is hard and the fact that a container does not have a startup message per se is touch too. (Just typing this did give me an idea. Maybe R on these containers should yell 'R for r-rel, RD for r-dev' .... One of these reasons we have r-rel there is for more consistent existing configurations.)
And I hear you. This stuff is hard. Have you seen my (old, relatively little known) CRAN package sanitzers ? It chiefly exists because I once chased my tail not being able to repro a UBSAN error when it turned out I had whiffed my setup. Now I have a baseline to validate 'yup UBSAN caught as expected'.
Back to your initial issue, maybe a bug report / pr against the website repo is in order but @eitsupi generally takes very good care of this. On the other part of 'damn this is hard' I'd be up for a zoom call to look over your shoulder time permitting but time is always in short supply, I tend to be fried in the (Central time) evenings and I am also just coming off a flu. Oh and travel is coming up. But maybe ping me. Worst case I say 'no cannot do'.
Yes, I did see the sanitizers
package, and it was indeed telling me that I somehow failed to get the setup right (i.e., there were no warnings/errors coming from the 'positive controls'). I will bang my head on this for a while longer before I ask for help again ...
This "tutorial in under a minute" fits into a screenful (and is straight from the README.md so it helps me to verify it still applies) so here you go:
edd@rob:~$ cd git/sanitizers/ # after reading you previous comment
edd@rob:~/git/sanitizers(master)$ dkrrrm rocker/r-devel-san bash # dkrrrm is an alias for 'd(oc)k(e)r r(un) (as) r(oot) m(ounted)' for the local dir
root@af668181ca3f:/work# RD CMD INSTALL .
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘sanitizers’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Debian 13.2.0-25) 13.2.0’
using C++ compiler: ‘g++ (Debian 13.2.0-25) 13.2.0’
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++17 -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
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -std=gnu11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c init.c -o init.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -Wall -pedantic -mtune=native -c int_overflow.cpp -o int_overflow.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++17 -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++17 -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o sanitizers.so heap_address.o init.o int_overflow.o stack_address.o -L/usr/local/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-work/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)
root@af668181ca3f:/work# Rscript -e 'sanitizers::stackAddressSanitize()' # actual typo / think but because 'UBSAN' instrumentation happens at _build-time_ it works
stack_address.cpp:16:32: runtime error: index 110 out of bounds for type 'int [100]'
stack_address.cpp:16:11: runtime error: load of address 0x7fff2efdb608 with insufficient space for an object of type 'int'
0x7fff2efdb608: note: pointer points here
b8 62 00 00 5e 2a 5b 62 ab 7a 00 00 00 00 00 00 00 00 00 00 70 66 5f 62 ab 7a 00 00 70 c9 26 2f
^
[1] 1650141790
root@af668181ca3f:/work#
root@af668181ca3f:/work# RDscript -e 'sanitizers::stackAddressSanitize()' # what I meant in the first place
stack_address.cpp:16:32: runtime error: index 110 out of bounds for type 'int [100]'
stack_address.cpp:16:11: runtime error: load of address 0x7ffff7e736d8 with insufficient space for an object of type 'int'
0x7ffff7e736d8: note: pointer points here
ff 7f 00 00 a8 c5 40 f9 b5 72 00 00 f0 37 e7 f7 ff 7f 00 00 1a d6 53 f9 b5 72 00 00 e0 20 00 00
^
[1] -113195608
root@af668181ca3f:/work#
As expressed here, I'm obviously doing something wrong/being confused about how to use this image. When I pull and run this image, I apparently get version 4.4.0. Is that because I'm still on Ubuntu 22.04 (jammy via Pop!OS) ... ? I really have no idea what else I could be doing wrong.