r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.39k stars 760 forks source link

devtools fails in paths with utf-8 letters #2422

Closed clemenskuehn closed 11 months ago

clemenskuehn commented 2 years ago

Hi, I am using R on windows in germany in folders with non-standard letters (e.g. ü)

I have been using devtools on windows with R 4.0.2 and R 4.1.2 with not too many problems. Recently, I have updated all packages and since then, pretty much nothing of devtools works in projects in folders containing non-standard letters. I always (e.g. for devtools::test()) get the same error message:

Error: Can't find PATH

Copying the project into a folder with only standard letters, everything works well.

So it seems, the issue about encoding of path names has come up to me again, though I thought something like that had been fixed.

Could this be related to the new handling of windows-encodings in R 4.2? It is not possible for me to install R 4.2 yet for administrative reasons.

Thank you, Clemens

jennybc commented 2 years ago

Can you give me a precise example of a path and the devtools command(s) that fail, with error message?

devtools is mostly a wrapper around calls to other packages, so it's impossible to troubleshoot this without additional specifics.

clemenskuehn commented 2 years ago

Hi, I here's the most reproducible example I can produce right now: On a machine with Windows Server 2016 Standard, RStudio 1.4.1717, R 4.0.2 (sessionInfo() output pasted below) I:

Fehler: Can't find 'E:/Rprog/Foldername_with_ü/umlaut'. Ausf�hrung angehalten

Exited with status 1.


- Console `devtools::test() `gives
`Error: Can't find 'E:/Rprog/Foldername_with_ü/umlaut'.`
- Also, `use_test()` fails similarly but with a slightly different error message:
`Error: Directory 'E:/Rprog/Foldername_with_ü/umlaut' does not exist.`

- also, when creating an R-file with a simple print message inside the tests-subfolder and runnning "Test Package" Ctrl-Shift-T without the tickmark under project options "Use devtools package functions if available", the test runs.

One more thing I noticed is that somewhere along the line at package creation, RStudio does create a folder E:\Rprog\Foldername_with_�

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server x64 (build 14393)

Matrix products: default

locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 [4] LC_NUMERIC=C LC_TIME=German_Germany.1252

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

other attached packages: [1] devtools_2.4.3 usethis_2.1.5

loaded via a namespace (and not attached): [1] rstudioapi_0.13 magrittr_2.0.3 pkgload_1.2.4 R6_2.5.1 rlang_1.0.2 fastmap_1.1.0
[7] tools_4.0.2 pkgbuild_1.3.1 sessioninfo_1.2.2 cli_3.2.0 withr_2.5.0 ellipsis_0.3.2
[13] remotes_2.4.2 rprojroot_2.0.3 lifecycle_1.0.1 crayon_1.5.1 brio_1.1.3 processx_3.5.3
[19] purrr_0.3.4 callr_3.7.0 fs_1.5.2 ps_1.6.0 testthat_3.1.3 memoise_2.0.1
[25] glue_1.6.2 cachem_1.0.6 compiler_4.0.2 desc_1.4.1 prettyunits_1.1.1

jennybc commented 2 years ago

This appears to be a bug in the fs package, which is affecting both devtools and usethis. So it will have to get fixed there. I've reported it: https://github.com/r-lib/fs/issues/383

jennybc commented 2 years ago

@clemenskuehn If it is an option for you, I highly recommend upgrading to R 4.2, in which R on Windows finally uses UTF-8 as the native encoding. A great many encoding problems will just vanish for you, if you can possibly upgrade (we'll still fix this, but that takes some time).

clemenskuehn commented 2 years ago

Thank you! Upgrading to R 4.2 sounds like a great plan, but unfortunately is not an immediate option inside the organization that this problem arose in.

jennybc commented 2 years ago

Upgrading to R 4.2 sounds like a great plan, but unfortunately is not an immediate option inside the organization that this problem arose in.

Understood. We do aim to support several previous R versions, so this will get fixed, but not as quickly as one can upgrade R (well, for those who can).

jennybc commented 11 months ago

Closing this, since the fix can't be made here.