New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink setting the lib path in the child process #73

gaborcsardi opened this Issue Aug 9, 2018 · 1 comment


None yet
1 participant
Copy link

gaborcsardi commented Aug 9, 2018

The goal is to make sure that these are always the same:

callr::r(function()  .libPaths())
callr::r(function() callr::r(function()  .libPaths()))

and the same for .Library and also

The lib path can be set in various places:

  • inherited R_LIBS + R_LIBS_USER + R_LIBS_SITE env vars
  • system .Renviron (R_ENVIRON or R_HOME/etc/`)
  • user .Renviron (R_ENVIRON_USER or ./.Renviron or ~.Renviron)
  • system .Rprofile (R_PROFILE or R_HOME/etc/
  • user .Rprofile (R_PROFILE_USER or ./.Rprofile or ~/.Rprofile)
  • R session via .libPaths()

Our strategy is to make sure that .Library, and .libPaths() are all the same in the child process, and that they are set up in such a way that the whole child tree inherits their value. (Unless a process changes them deliberately.)


This is always the system library and we can't modify it. So we don't need to do anything with this.

This can come from

  1. inherited env var R_LIBS_SITE
  2. system .Renviron R_LIBS_SITE
  3. user .Renviron R_LIBS_SITE
  4. system setting directly

So we set this in the system profile. We set R_PROFILE to point to this file.

  • if the profile was requested, we make a copy of it, and add setting
  • if the profile was not requested, we just include setting

R sessions with --no-site-file, will get the proper if it was set via R_LIBS_SITE somewhere. Otherwise they won't, which makes sense.


This is similar, but can also be set in the user profile, and in the session itself as well. So we create a fake user session file as well, and set it there as well, and the fake system session file as well.

gaborcsardi added a commit that referenced this issue Aug 16, 2018

gaborcsardi added a commit that referenced this issue Aug 16, 2018

Rewrite libpath handling and passing (#75)
* Rewrite lib path setting in child

According to #73

* Redocument

* Update docs about env vars set

Also closes #71

* Fix libpath tests on windows

* Fix test cases on Windows

Removed the connection-close test case,
because it does not seem to work on Windows.

This comment has been minimized.

Copy link
Member Author

gaborcsardi commented Aug 20, 2018

Done by #75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment