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

tar error install_github #350

Closed
kuzmenkov111 opened this issue Apr 12, 2019 · 5 comments · Fixed by #393
Closed

tar error install_github #350

kuzmenkov111 opened this issue Apr 12, 2019 · 5 comments · Fixed by #393

Comments

@kuzmenkov111
Copy link

kuzmenkov111 commented Apr 12, 2019

Hello!

I have a trouble with remotes::install_github("user/package"). R 3.5.1 Microsoft R Open. Ubuntu 18.04 in container. There is an error in tar after just rebuilding container without changing anything.

remotes::install_github('rstudio/DT') Downloading GitHub repo rstudio/DT@master tar: This does not look like a tar archive gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now tar: This does not look like a tar archive gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now Error in getrootdir(untar(src, list = TRUE)) : length(file_list) > 0 is not TRUE Calls: <Anonymous> ... source_pkg -> decompress -> getrootdir -> stopifnot In addition: Warning messages: 1: In utils::untar(tarfile, ...) : ‘tar -xf '/tmp/RtmpitCFRe/file2677442609b8.tar.gz' -C '/tmp/RtmpitCFRe/remotes267752f2629f'’ returned error code 2 2: In system(cmd, intern = TRUE) : running command 'tar -tf '/tmp/RtmpitCFRe/file2677442609b8.tar.gz'' had status 2 Execution halted

May tell me what is going wrong?

@jimhester
Copy link
Member

It looks like your tar program is not working correctly, or possibly the download is not complete. What does Sys.getenv("tar") return?

@alexvorobiev
Copy link

I ran it in the debugger. At least in my case the issue was not with tar. The real issue is the default download method (curl) does not follow HTTP redirects (and gives no warnings about that). The result is a zero-length file which tar cannot unpack. I don't know whether it is github itself or corporate firewalls/proxy/MITM. The workaround is to add this curl option

options(download.file.extra = paste0("-L ", getOption("download.file.extra", default = ""))

After that install_github works again.

@mvabl-steve
Copy link

mvabl-steve commented May 8, 2019

I am having this issue too, and I just can't figure it out. Sys.getenv("tar") yields [1] "".Sys.getenv("TAR") gives [1] "/usr/bin/tar". I'm a novice developer. Anyone have any explicit suggestions I can learn from?

MacBook Air (13-inch, 2017)
Mojave 10.14.4

platform       x86_64-apple-darwin15.6.0   
arch           x86_64                      
os             darwin15.6.0                
system         x86_64, darwin15.6.0        
status                                     
major          3                           
minor          5.2                         
year           2018                        
month          12                          
day            20                          
svn rev        75870                       
language       R                           
version.string R version 3.5.2 (2018-12-20)
nickname       Eggshell Igloo       

RStudio Version 1.1.423

@nextpagesoft
Copy link

nextpagesoft commented May 18, 2019

I have had the same issue (Ubuntu 19.04, R 3.6.0). First of all check if the downloaded file tar.gz has any content at all. Name of the file is included in the error message. In @kuzmenkov111 post it is '/tmp/RtmpitCFRe/file2677442609b8.tar.gz' and you can do that in R with:

file.info("/tmp/RtmpitCFRe/file2677442609b8.tar.gz")

In my case it had size 0 so clearly downloading was not successful, so I started digging in.

Line 73 in function base_download selects download method. In my case getOption("download.file.method") was returning curl. Setting it to libcurl:

options("download.file.method" = "libcurl")

cured the problem with no content and devtools::install_github succeeded.

I don't know how option "curl" was set in the first place. Maybe this is what R 3.6.0 defaults to.

@DaveParr
Copy link

Same issue, macOS Mojave, 10.14.4, R 3.6.

This exact issue has hit me multiple times with multiple packages now. And

options(download.file.extra = paste0("-L ", getOption("download.file.extra", default = ""))) has worked each time so far.

jimhester added a commit that referenced this issue Jun 24, 2019
By default external curl does not follow redirects, but GitHub uses 302
redirects extensively, causing downloads to fail.

Fixes #350
jimhester added a commit that referenced this issue Jun 24, 2019
By default external curl does not follow redirects, but GitHub uses 302
redirects extensively, causing downloads to fail.

Fixes #350
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

Successfully merging a pull request may close this issue.

6 participants