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

usethis::create_package() fails in temporary directory #2069

Open
kevinushey opened this issue Oct 7, 2024 · 1 comment
Open

usethis::create_package() fails in temporary directory #2069

kevinushey opened this issue Oct 7, 2024 · 1 comment

Comments

@kevinushey
Copy link
Contributor

kevinushey commented Oct 7, 2024

> usethis::create_package("/tmp/project")
Error in `check_path_is_directory()`:
✖ private/tmp is not a directory.
Run `rlang::last_trace()` to see where the error occurred.
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.0

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
 [1] compiler_4.4.1  magrittr_2.0.3  cli_3.6.3       tools_4.4.1
 [5] pillar_1.9.0    fs_1.6.4        glue_1.8.0      tibble_3.2.1
 [9] utf8_1.2.4      fansi_1.0.6     vctrs_0.6.5     usethis_3.0.0
[13] lifecycle_1.0.4 pkgconfig_2.0.3 rlang_1.1.4     purrr_1.0.2

The problem here occurs because /tmp is a symlink to private/tmp, but it doesn't get resolved correctly. Here:

usethis/R/directory.R

Lines 42 to 44 in b4e8477

if (is_link(path)) {
path <- link_path(path)
}

But:

Browse[1]> fs::link_path("/tmp")
private/tmp

Note that the link path is relative, not absolute, and so needs to be interpreted relative to the directory holding the symlink.

kevin@MBP-P2MQ:/
$ ll | grep tmp
lrwxr-xr-x@  1 root  wheel    11B Sep  5 13:54 tmp@ -> private/tmp
@kevinushey
Copy link
Contributor Author

The simplest solution here is probably just to use normalizePath() or the fs equivalent here?

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

No branches or pull requests

1 participant