[R-pkg-devel] Failing to write config file in linux

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Mon Oct 23 21:07:31 CEST 2023


From CRAN policy (which you agreed to when you submitted your package) - note in particular the "nor anywhere else on the file system" part and also note that it tells you what to do in your case:


Packages should not write in the user’s home filespace (including clipboards), nor anywhere else on the file system apart from the R session’s temporary directory (or during installation in the location pointed to by TMPDIR: and such usage should be cleaned up). Installing into the system’s R installation (e.g., scripts to its bin directory) is not allowed.
Limited exceptions may be allowed in interactive sessions if the package obtains confirmation from the user.

For R version 4.0 or later (hence a version dependency is required or only conditional use is possible), packages may store user-specific data, configuration and cache files in their respective user directories obtained from tools::R_user_dir(), provided that by default sizes are kept as small as possible and the contents are actively managed (including removing outdated material).




> On Oct 23, 2023, at 5:52 AM, Keshav, Krishna <kkeshav using ufl.edu> wrote:
> 
> Hi,
> 
> My package is failing on linux based systems because of an attempt to write in a location of package. One of the core features that we would like user to have is to modify the values in the config file, for which package has a function for user to provide modified config. In future, they should be able to provide individual parameters for the config for which also we will be writing to config in package directory /inst/ so that it can later be fetched. I understand that policy doesn’t allow writing to home directory. Is there a workaround for this? Or what could be other potential solutions to explore.
> 
> Snippet –
> https://github.com/GarrettLab/CroplandConnectivity/blob/923a4a0ca4a0ce8376068ee80986df228ea21d80/geohabnet/R/params.R#L57
> 
> Error –
>     ── Failure ('test-parameters.R:38:3'): Test 6: Test to set new parameters.yaml ──
>     Expected `set_parameters(new_param_file)` to run without any conditions.
>     ℹ Actually got a <simpleWarning> with text:
>     cannot create file '/home/hornik/tmp/R.check/r-release-gcc/Work/build/Packages/geohabnet/parameters.yaml', reason 'Read-only file system'
> 
> 
> Best Regards,
> Krishna Keshav
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel




More information about the R-package-devel mailing list