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

fread tries to use wget on file:// input in RStudio #1668

Closed
MichaelChirico opened this issue Apr 22, 2016 · 2 comments
Closed

fread tries to use wget on file:// input in RStudio #1668

MichaelChirico opened this issue Apr 22, 2016 · 2 comments

Comments

@MichaelChirico
Copy link
Member

MichaelChirico commented Apr 22, 2016

Not sure what's going on here, but two tests fail when I run them in R Studio, but not from command line:

library(data.table)
test.data.table()

Running test id 1378.2 Test 1378.2 Error in download.file(input, tt, mode = "wb", quiet = !showProgress) :
(converted from warning) download had nonzero exit status
Running test id 1378.3 Test 1378.3 didn't produce correct error :
fread(f, showProgress = FALSE)
Expected error: 'Line ending is ._r._r._n. R's download.file() appears to add the extra ._r in text mode on Windows. Please download again in binary mode (mode='wb') which might be faster too. Alternatively, pass the URL directly to fread and it will download the file in binary mode for you.'
Observed warning: 'download had nonzero exit status'

However, when I run from terminal:

R -e 'library(data.table); test.data.table()'

All is well:

All 5385 tests (lastID=1668.5) in inst/tests/tests.Rraw completed ok in 00:01:20 on Fri Apr 22 16:48:58 2016 (endian=little, sizeof(long double)==16)

Running 3.2.4 on RStudio 0.99.878, Linux Mint 17.3 = Ubuntu 14.04.3 LTS

I've been experiencing this for a while, but ignoring it because all the PRs pass Travis, etc. I only discovered the bit about the command line today, I was a bit surprised.

@jangorecki
Copy link
Member

jangorecki commented Apr 22, 2016

My guess is that RStudio may silently change download.method option and affect output, comparing to base R.
Anyway if it works in R, and just not works in RStudio then you should report it to RStudio. Base R should be the platform to which other projects should be conformed.

As you are on linux you may find my 3 helpful scripts:

# dt.build
R CMD build data.table --no-manual
# dt.install
R CMD INSTALL data.table_1.9.7.tar.gz
# dt.check
R CMD check data.table_1.9.7.tar.gz --no-manual --as-cran

Use chmod to make them executable, and call in shell from parent dir of data.table:

./dt.build && ./dt.install # install devel
./dt.build && ./dt.check # check devel

Once I started to use them I had no need to debug issues related to intermediate helpers. It also plays nicely when switching to other branches.

@MichaelChirico
Copy link
Member Author

Indeed, because I have the "Use secure download method for HTTP" option set in Tools>Global Options...>Packages, getOption("download.file.method", default = "auto") is set to wget, which doesn't support file:///.

Seems like a fix would be to force curl in the case that is_file is true.

Gonna put a PR to that end.

@MichaelChirico MichaelChirico changed the title [Internals] Tests 1378.2, 1378.3 fail in RStudio fread tries to use wget on file:// input in RStudio Apr 23, 2016
arunsrinivasan added a commit that referenced this issue Apr 24, 2016
Closes #1668; download.file in fread forced to "auto" for file:// input
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

No branches or pull requests

2 participants