[Rd] R for Windows leaves detritus in the temp directory
Henrik Bengtsson
henr|k@bengt@@on @end|ng |rom gm@||@com
Tue Jun 15 18:19:43 CEST 2021
ISSUE:
The TMPDIR validation done in src/gnuwin32/system.c:
/* in case getpid() is not unique -- has been seen under Windows */
snprintf(ifile, 1024, "%s/Rscript%x%x", tm, getpid(),
(unsigned int) GetTickCount());
ifp = fopen(ifile, "w+b");
if(!ifp) R_Suicide(_("creation of tmpfile failed -- set TMPDIR suitably?"));
}
does _not_ clean up after itself, i.e. there's a missing
unlink(ifile);
In contrast, ditto in src/unix/system.c does this.
BACKGROUND:
When running R CMD check --as-cran on my 'future' package, I get:
* checking for detritus in the temp directory ... NOTE
Found the following files/directories:
'Rscript171866c62e'
when checked on R Under development (unstable) (2021-06-13 r80496),
including on win-builder. I can reproduce this with a package
'tests/detritus.R':
cl <- parallel::makeCluster(1)
dummy <- parallel::clusterEvalQ(cl, {
cl <- parallel::makeCluster(1)
on.exit(parallel::stopCluster(cl))
parallel::clusterEvalQ(cl, Sys.getpid())
})
print(dummy)
parallel::stopCluster(cl)
I believe it requires a nested PSOCK cluster to reproduce the 'R CMD
check' NOTE, e.g. it does _not_ happen with:
cl <- parallel::makeCluster(1)
dummy <- parallel::clusterEvalQ(cl, {
Sys.getpid()
})
print(dummy)
parallel::stopCluster(cl)
/Henrik
More information about the R-devel
mailing list