Hi, A package of ours had its test code throw an error during its R CMD CHECK on CRAN due to it attempting to write files to the installation directory. We were wondering how best to replicate this test on our local machines as we are unable to see any direct options / flags / hooks within R CMD CHECK that allows you to specify that the installation directory should be set to read-only ?
>From the "Writing R extensions" manual there appears to be an option that allows you to run R CMD CHECK on an installed package (I think technically it is running on the source package but it suppresses the installation step and uses the pre-installed version for running the tests). Quoting the manual below: > It is possible to install a package and then check the installed package. To > do so first install the package and keep a log of the installation: > R CMD INSTALL -l libdir pkg > pkg.log 2>&1 > and then use > Rdev CMD check -l libdir --install=check:pkg.log pkg This appears to do what we need in that we can first install the package locally, set the directory to read-only with `chmod 500` and then run R CMD CHECK using the arguments as specified above from the manual. HOWEVER - this approach appears to have a bug in that if the source code doesn't have an explicit `Author` and `Maintainer` field then the check will fail; that is to say it doesn't appear to be able to expand the `Author@R` field when running in this mode. So to summarise my questions are: * Is my described use of Rdev CMD check -l libdir --install=check:pkg.log pkg the correct way of using R CMD CHECK to test if the installed package is writing to the installation directory ? * If not, what is the recommended way of using R CMD CHECK to catch this (e.g. how to replicate how CRAN runs R CMD CHECK to catch this) ? * If yes, is it regarded as a bug or not that R CMD CHECK on installed packages only works for packages that have an explicit Author / Maintainer field and not just a Author@R field? With regards to the potential bug with R CMD CHECK; I tested this on R 4.4.2 on Mac OS Sonoma and have uploaded a small test script to GitHub that demonstrates it: https://gist.github.com/gowerc/248f398f421750f7673019d1989cbe6f#file-simple_script-sh Kind Regards Craig Gower-Page ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel