Skip to content

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

Open
@kevinushey

Description

@kevinushey
> 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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions