Skip to content

Commit

Permalink
Add ubsan devcontainer (#5850)
Browse files Browse the repository at this point in the history
* add multiple containers

add symlinks

add RUN

use echo to create .Rprofile

add workdir

symlink + echo

add dependencies for check

add char vec

update echo

update dockerfile

fix FROM

update dirs

use rocker image

rollback to jans clang image

change docker order

change flags

update makevars

update flags

add workdir

change C version

clang working

rm local .Rprofile

* tidy spaces

* update flags to #5509

* Robust deps install, use files over echo, tidy

* no ARG

* Wrong context?

* need to COPY DESCRIPTION. Try more WORKDIR.

* attempt to fix Makevars, .Rprofile

* Try copying .Rprofile to /root. Remove ~/GitHub for now.

* same changes to gcc container

* Try adding REdtiorSupport extension by default

* load cc conditionally

* Don't install languageserver by default (slow)

* udpate image and makevars

* drop native

* terminal newline

* whitespace

* whitespace

---------

Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Co-authored-by: Michael Chirico <chiricom@google.com>
  • Loading branch information
3 people authored Dec 22, 2023
1 parent 4333884 commit eace83a
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .devcontainer/Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json

This file was deleted.

2 changes: 2 additions & 0 deletions .devcontainer/r-devel-clang-ubsan/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sys.setenv(PROJ_PATH='/workspaces/data.table')
if (file.exists('.dev/cc.R')) source('.dev/cc.R')
23 changes: 23 additions & 0 deletions .devcontainer/r-devel-clang-ubsan/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM rocker/r-devel-ubsan-clang:latest

RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends git

COPY DESCRIPTION .

# install dependencies without ubsan flags
RUN Rscript -e ' \
read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \
tools:::.split_dependencies() |> \
names() |> \
setdiff(tools:::.get_standard_package_names()$base) |> \
install.packages() \
'

# setup cc()
WORKDIR /root
COPY .devcontainer/r-devel-clang-ubsan/.Rprofile .

# set ubsan flags
WORKDIR .R
COPY .devcontainer/r-devel-clang-ubsan/Makevars .
6 changes: 6 additions & 0 deletions .devcontainer/r-devel-clang-ubsan/Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CC=clang -fsanitize=address,undefined -fno-sanitize=float-divide-by-zero -fno-sanitize=alignment -fno-omit-frame-pointer
CXX=clang++ -fsanitize=address,undefined -fno-sanitize=float-divide-by-zero -fno-sanitize=alignment -fno-omit-frame-pointer -frtti
CFLAGS=-g -O3 -Wall -pedantic
FFLAGS=-g -O2
CXXFLAGS=-g -O3 -Wall -pedantic
LDFLAGS=-L/usr/lib/gcc/x86_64-linux-gnu/11/libubsan.so -lubsan
4 changes: 4 additions & 0 deletions .devcontainer/r-devel-clang-ubsan/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"build": { "dockerfile": "Dockerfile", "context": "../.." },
"customizations": { "vscode": { "extensions": [ "REditorSupport.r" ] } }
}
2 changes: 2 additions & 0 deletions .devcontainer/r-devel-gcc/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sys.setenv(PROJ_PATH='/workspaces/data.table')
if (file.exists('.dev/cc.R')) source('.dev/cc.R')
18 changes: 18 additions & 0 deletions .devcontainer/r-devel-gcc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM registry.gitlab.com/jangorecki/dockerfiles/r-devel-gcc

RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends git

COPY DESCRIPTION .

RUN Rscript -e ' \
read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \
tools:::.split_dependencies() |> \
names() |> \
setdiff(tools:::.get_standard_package_names()$base) |> \
install.packages() \
'

# setup cc()
WORKDIR /root
COPY .devcontainer/r-devel-gcc/.Rprofile .
4 changes: 4 additions & 0 deletions .devcontainer/r-devel-gcc/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"build": { "dockerfile": "Dockerfile", "context": "../.." },
"customizations": { "vscode": { "extensions": [ "REditorSupport.r" ] } }
}

0 comments on commit eace83a

Please sign in to comment.