Windows: `R CMD check` leaves a `'NULL'` folder because the R_LIBS_USER block does not recognise the quoted `'NULL'`

Abierto Apto para principiantes
#552 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
r, rust
Área
backend, cli

Línea de trabajo

Start with the ## rig R_LIBS_USER start block that rig adds to <R_HOME>/library/base/R/Rprofile, then reproduce with the issue’s Rterm.exe commands on Windows. The reported failure is that quoted R_LIBS_USER='NULL' bypasses the check and creates a 'NULL' folder. Done means the block ignores that value and the folder is not created.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

On Windows, R CMD check --as-cran of any package ends with this NOTE when R was installed with rig:

* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
  ''NULL''

The folder is created by the ## rig R_LIBS_USER start block that rig adds to <R_HOME>/library/base/R/Rprofile:

userlibs <- strsplit(Sys.getenv("R_LIBS_USER"), .Platform$path.sep)[[1]]
if (length(userlibs) == 0) return()
if (userlibs[[1]] == "NULL") return()
userlib1 <- userlibs[1]
dir.create(userlib1, recursive = TRUE, showWarnings = FALSE)

R CMD check starts its child R processes (examples, tests, several code checks) with R_LIBS_USER='NULL' and R_LIBS_SITE='NULL'. On Windows these are passed as arguments to Rterm.exe, and the single quotes are kept, so Sys.getenv("R_LIBS_USER") is 'NULL' with the quotes. The test above does not match it, and dir.create() creates a folder named 'NULL' in the working folder of each child process: the check folder (from the examples), tests/, and 00_pkg_src/<pkg>/. With --as-cran, the folder in the check folder produces the NOTE.

Reproduce

In an empty folder, with a rig-installed R on Windows:

echo "invisible(1)" > in.R
Rterm.exe "R_LIBS_USER='NULL'" --vanilla -f in.R   # creates the folder 'NULL'
Rterm.exe R_LIBS_USER=NULL --vanilla -f in.R       # creates nothing

The same NOTE appears for a minimal package with one function and no dependencies.

Suggested fix

Strip surrounding quotes before the comparison, for example:

if (gsub("^['\"]|['\"]$", "", userlibs[[1]]) == "NULL") return()

Versions

  • rig 0.11.1
  • R 4.6.2 (ucrt), Windows 11
Lenguaje dominante
Rust
Estrellas
1k
Forks
42
Merge medio
10 h 7 min
PR fusionados (30 d)
23

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de r-lib/rig

Todos los issues de r-lib/rig

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.