| 1 |
|
| 2 |
renv_tempdir_init <- function() { |
| 3 |
|
| 4 |
# only check on linux |
| 5 |
if (!renv_platform_linux()) |
| 6 |
return() |
| 7 |
|
| 8 |
# allow disable via envvar if needed |
| 9 |
check <- Sys.getenv("RENV_TEMPDIR_NOEXEC_CHECK", unset = "TRUE") |
| 10 |
if (not(check)) |
| 11 |
return() |
| 12 |
|
| 13 |
# check that scripts within the R temporary directory can be executed |
| 14 |
script <- tempfile("renv-script-", fileext = ".sh") |
| 15 |
writeLines("#!/usr/bin/env sh", con = script) |
| 16 |
Sys.chmod(script, mode = "0755") |
| 17 |
on.exit(unlink(script), add = TRUE) |
| 18 |
|
| 19 |
status <- system(script, ignore.stdout = TRUE, ignore.stderr = TRUE) |
| 20 |
if (identical(status, 0L)) |
| 21 |
return() |
| 22 |
|
| 23 |
fmt <- heredoc(" |
| 24 |
|
| 25 |
The R temporary directory appears to be within a folder mounted as 'noexec'. |
| 26 |
Installation of R packages from sources may fail. |
| 27 |
See the section **Note** within `?INSTALL` for more details. |
| 28 |
|
| 29 |
tempdir(): %s |
| 30 |
|
| 31 |
") |
| 32 |
|
| 33 |
caution(fmt, tempdir(), con = stderr()) |
| 34 |
|
| 35 |
} |