r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
330 stars 152 forks source link

LC_ALL=C breaks install_github #728

Open frafra opened 1 year ago

frafra commented 1 year ago

install_github could break if LC_ALL is set to C. It looks like it uses the locale settings instead of the real encoding used for the description.

This is what is displayed when running: devtools::install_github('ropensci/NLMR'):

Line starting 'SystemRequir ...' is malformed!

This does not happen when using install_url from the very same GitHub repository, packed as a zip.

Related: https://github.com/ropensci/NLMR/issues/104

gaborcsardi commented 1 year ago

I cannot reproduce this, can you please try to create a reproducible example? Thanks.

frafra commented 1 year ago

The issue appears only if devtools are already installed.

This is a way to reproduce the error in both debian:bookworm and ubuntu:22.04, using containers:

  1. docker run --rm -ti debian:bookworm
  2. apt-get update && apt-get install -y r-base r-cran-devtools
  3. Rscript -e 'devtools::install_github("ropensci/NLMR")'
installed packages LC_ALL code result
r-base C install.packages("remotes");remotes::install_github("ropensci/NLMR") OK
r-base C.UTF-8 install.packages("remotes");remotes::install_github("ropensci/NLMR") OK
r-base r-cran-devtools C devtools::install_github("ropensci/NLMR") failure
r-base r-cran-devtools C install.packages("remotes");remotes::install_github("ropensci/NLMR") failure
r-base r-cran-devtools C.UTF-8 devtools::install_github("ropensci/NLMR") OK
r-base r-cran-devtools C.UTF-8 install.packages("remotes");remotes::install_github("ropensci/NLMR") OK

That would be with r-cran-devtools 2.4.4 and r-cran-remotes 2.4.2.

Unsuccessful execution:

Error: Failed to install 'unknown package' from GitHub:
  Line starting 'SystemRequir ...' is malformed!
Execution halted

Successful execution:

Downloading GitHub repo ropensci/NLMR@HEAD
[...]

It does not seem to fail when using remotes directly. I opened the issue here, as the devtools repository says: " Please open issues related to package installation here. ", and it links to this remotes repository.

gaborcsardi commented 1 year ago

This is a bug indeed, I am not sure where, though, probably in pkgbuild. This is a good workaround:

R_REMOTES_STANDALONE=true Rscript -e 'remotes::install_github("ropensci/NLMR")'