r-lib / remotes

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

tar.exe: Option --force-local is not supported #171

Closed surmann closed 6 years ago

surmann commented 6 years ago

When I use remotes::install_local(force = TRUE), because of "Skipping install of '...' from a local remote, the SHA1 (0.1.0-90) has not changed since last install." I get the error tar.exe: Option --force-local is not supported. I use a Windows 10 system.

Here is the complete output after the "DONE" statement:

* DONE (...)                                                                                                                                     
tar.exe: Option --force-local is not supported                                                                                                            
Usage:                                                                                                                                                    
  List:    tar.exe -tf <archive-filename>                                                                                                                 
  Extract: tar.exe -xf <archive-filename>                                                                                                                 
  Create:  tar.exe -cf <archive-filename> [filenames...]                                                                                                  
  Help:    tar.exe --help                                                                                                                                 
Error in if (inherits(status, "try-error") || status != 0) { :                                                                                            
  missing value where TRUE/FALSE needed                                                                                                                   
In addition: Warning message:                                                                                                                             
In system(cmd, intern = TRUE) :                                                                                                                           
  running command 'tar.exe -ztf "C:\Users\Name\AppData\Local\Temp\RtmpScq6Pl\file2688718c77bb\..._0.1.0-9000.tar.gz" --force-local' had status 1

Do you have an idea?

gaborcsardi commented 6 years ago

Seems like utils::untar() returns NULL? It should not do that, according to the docs, and AFAICT the version on my R 3.5.1 does not. What is your R version?

jimhester commented 6 years ago

The output of Sys.getenv("TAR") would be useful as well

surmann commented 6 years ago

I use R 3.5.1. The result of utils::untar("file.tar") is 0 not NULL. However, no files are extracted. Sys.getenv("TAR") gives me "".

gaborcsardi commented 6 years ago

Oh, of course, system() runs tar with intern = TRUE, so we'll have to look at the status attribute of the result.

surmann commented 6 years ago

Do you need here something from my side?

gaborcsardi commented 6 years ago

If you could try this, that would help: https://github.com/r-lib/remotes/pull/172

You can install it with

remotes::install_github("r-lib/remotes#172")

Or, if remotes fails on this as well, then like this:

source("https://raw.githubusercontent.com/r-lib/remotes/master/install-github.R")$value("r-lib/remotes#172")
surmann commented 6 years ago

We are one step further. I am on ac44630. This is the output now:

* DONE (package)
tar.exe: Option --force-local is not supported
Usage:
  List:    tar.exe -tf <archive-filename>
  Extract: tar.exe -xf <archive-filename>
  Create:  tar.exe -cf <archive-filename> [filenames...]
  Help:    tar.exe --help
External tar failed with `--force-local`, trying without
tar.exe: Option --force-local is not supported
Usage:
  List:    tar.exe -tf <archive-filename>
  Extract: tar.exe -xf <archive-filename>
  Create:  tar.exe -cf <archive-filename> [filenames...]
  Help:    tar.exe --help
External tar failed with `--force-local`, trying without
Package 'package' has been installed to 'C:/Users/name/Documents/RPackages'
Warning messages:
1: In system(cmd, intern = TRUE) :
  running command 'tar.exe -ztf "C:\Users\name\AppData\Local\Temp\RtmpkR0eif\file3504243b42eb\package_0.1.0-9000.tar.gz" --force-local' had status 1
2: In utils::untar(tarfile, extras = "--force-local", ...) :
  'tar.exe -zxf "C:\Users\name\AppData\Local\Temp\RtmpkR0eif\file3504243b42eb\package_0.1.0-9000.tar.gz" -C "C:/Users/name/AppData/Local/Temp/RtmpkR0eif/file350458df56e8" --force-local "package/DESCRIPTION"' returned error code 1
gaborcsardi commented 6 years ago

Yeah, I think this means that the package was successfully installed, and everything works properly. We should still clean up the output from the failed tarcalls, I'll do that in a minute.

gaborcsardi commented 6 years ago

OK, can you pls. try again?

surmann commented 6 years ago

I use remotes * 1.1.1.9000 2018-09-27 Github (r-lib/remotes@54146c0)

> remotes::install_local(force = TRUE) gives me

* DONE (package)
tar.exe: Option --force-local is not supported
Usage:
  List:    tar.exe -tf <archive-filename>
  Extract: tar.exe -xf <archive-filename>
  Create:  tar.exe -cf <archive-filename> [filenames...]
  Help:    tar.exe --help
External tar failed with `--force-local`, trying without
tar.exe: Option --force-local is not supported
Usage:
  List:    tar.exe -tf <archive-filename>
  Extract: tar.exe -xf <archive-filename>
  Create:  tar.exe -cf <archive-filename> [filenames...]
  Help:    tar.exe --help
External tar failed with `--force-local`, trying without
gaborcsardi commented 6 years ago

Hmmm, it seems like suppressing that output is a bit more tricky. But I assume the installation worked properly otherwise?

surmann commented 6 years ago

Yes.

However, why do you send an option to tar.exe which is not supported? Is is possible to skip this option instead of suppressing the errors?

gaborcsardi commented 6 years ago

Because many tar programs do support it, and they behave better with this option. So we first try with the option, and if it does not work we fall back. The fall back now works properly with #172, but unfortunately it is hard to suppress the error message for the first try.

We could add an option for this, but in general it is better to avoid options, whenever it is possible to have a sane behavior on all systems.

surmann commented 6 years ago

Ok, thanks!