HenrikBengtsson / Wishlist-for-R

Features and tweaks to R that I and others would love to see - feel free to add yours!
https://github.com/HenrikBengtsson/Wishlist-for-R/issues
GNU Lesser General Public License v3.0
134 stars 4 forks source link

R CMD check: Option for reporting on writes/updates to tools::R_user_dir() during checks #155

Open HenrikBengtsson opened 10 months ago

HenrikBengtsson commented 10 months ago

Something like:

$ export _R_CHECK_THINGS_IN_USER_DIR_=true
$ R CMD check --as-cran R.cache_0.16.0.tar.gz
* using log directory ‘/home/henrik/tmp/R.cache.Rcheck’
* using R version 4.3.2 (2023-10-31)
...
  Running ‘textPrompt.R’
 OK
* checking PDF version of manual ... OK
* checking HTML version of manual ... OK
* checking for non-standard things in the check directory ... OK
* checking for detritus in the temp directory ... OK
* checking for detritus in the user cache directory ... NOTE
Found the following added (A), removed (R), or modified (M) files:
A 42b71ea60b7c385ad29633002f402f72 431B 2023-12-12T11:03:19 README.txt
* checking for detritus in the user config directory ... OK
* checking for detritus in the user data directory ... OK
* DONE

Status: OK

See also

This is not the solution to, but it's related to a discussion on running R CMD check with an already populated cache over that the Bioconductor #bioc-builds channel, cf. https://community-bioc.slack.com/archives/CEQ04GKEC/p1702394023260179?thread_ts=1701914888.153329&cid=CEQ04GKEC

HenrikBengtsson commented 10 months ago

BLOCKER: It will be hard to discern writes/updates made by the R CMD check run from those that may occur from other R processes running on the same machine by the same user.

The only way to resolve this, is to use session-specific user folders. This can be achieved by setting R_USER_DATA_DIR, R_USER_CONFIG_DIR, and R_USER_CACHE_DIR (from ?tools::R_user_dir()) to temporary folders. This would in turn lead to all checks being run with empty file caches, etc.