Skip to content
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

Cache location incorrect on Linux #83

Closed
ateucher opened this issue Jan 12, 2021 · 4 comments · Fixed by #84
Closed

Cache location incorrect on Linux #83

ateucher opened this issue Jan 12, 2021 · 4 comments · Fixed by #84

Comments

@ateucher
Copy link
Collaborator

ateucher commented Jan 12, 2021

From CRAN:

Checking this on Linux creates and leaves behind

~/.local/share/bcmaps

in violation of the CRAN Policy's

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).

Can you please change as necessary, ideally using the
tools::R_user_dir() mechanism where available?

Please fix before 2021-01-26 to safely retain your package on CRAN.

We are using rappdirs::user_data_dir(), which on Unix uses ~/.local/share/<appname>.

Perhaps we should use tools::R_user_dir() (R >= 4.0) or rappdirs::user_cache_dir() which uses ~/.local/cache/<appname>?

From the help for tools::R_user_dir(), it creates an R subfolder in the user/cache directory (~/.local/cache/R/<appname> - hopefully rappdirs can do the same for R < 4.0.

@ateucher
Copy link
Collaborator Author

ateucher commented Jan 12, 2021

Looks like it can:

> tools::R_user_dir("foo", "cache")
# [1] "/Users/ateucher/Library/Caches/org.R-project.R/R/foo"

rappdirs::user_cache_dir("org.R-project.R/R/foo")
# [1] "/Users/ateucher/Library/Caches/org.R-project.R/R/foo"

@boshek @stephhazlitt can you check to see if you get the same behaviour on your machines?

@boshek
Copy link
Collaborator

boshek commented Jan 12, 2021

On Ubuntu:

>  rappdirs::user_cache_dir("org.R-project.R/R/foo")
[1] "/home/salbers/.cache/org.R-project.R/R/foo"
>  tools::R_user_dir("foo", "cache")
[1] "/home/salbers/.cache/R/foo"

So a little bit different. And then windows:

> rappdirs::user_cache_dir("org.R-project.R/R/foo")
[1] "C:\\Users\\salbers\\AppData\\Local\\org.R-project.R\\R\\foo\\org.R-project.R\\R\\foo\\Cache"
> tools::R_user_dir("foo", "cache")
[1] "C:\\Users\\salbers\\AppData\\Local/R/cache/R/foo"

@ateucher
Copy link
Collaborator Author

Ok so then probably for R < 4.0 we just stick to current rappdirs (without prepending any R/ etc paths), and use tools::R_user_dir() for R >= 4.0. I also suggest we switch to cache from data?

@boshek
Copy link
Collaborator

boshek commented Jan 12, 2021

I think that is the approach. My only consideration here is that when a user switches from 3.* to 4.* they will have to re-download all the layers. Do you think it would be worth have a function clean up the files at the 3.* path?

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

Successfully merging a pull request may close this issue.

2 participants