r-lib / crancache

Transparent caching of CRAN package files - WORK IN PROGRESS!
Other
28 stars 2 forks source link

update_cache_binaries(): length(x) = 2 > 1' in coercion to 'logical(1) ERROR #35

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 5 years ago

In update_cache_binaries(), there's:

https://github.com/r-lib/crancache/blob/e2185c76b6fcd36c9970cfa22ffd2cb62b13eb53/R/binaries.R#L7-L8

That grepl() statement can resolve to a logical vector of any length.

I just ran into this indirectly (sorry, tried but fail to reproduce and don't have much time) where I ran with:

_R_CHECK_LENGTH_1_CONDITION=true
_R_CHECK_LENGTH_1_LOGIC2_=true

and received:

...
Adding 'fs_1.3.0.tar.gz' to the cache
Error in "INSTALL_opts" %in% names(args) && grepl("--no-test-load", args$INSTALL_opts,  : 
  'length(x) = 2 > 1' in coercion to 'logical(1)'
Calls: <Anonymous> ... update_cache -> update_cache_safe -> update_cache_binaries
jennybc commented 2 years ago

I just hit this in a bookdown render workflow (which is neither here nor there). I doubt it really matters, but in case there's useful info, here's what it looked like:

trying URL 'https://cloud.r-project.org/bin/macosx/contrib/4.1/magrittr_2.0.3.tgz'
Content type 'application/x-gzip' length 227497 bytes (222 KB)
==================================================
downloaded 222 KB

Quitting from lines 1018-1019 (Whole-game.Rmd) 
Error in "INSTALL_opts" %in% names(args) && grepl("--no-test-load", args$INSTALL_opts,  : 
  'length(x) = 2 > 1' in coercion to 'logical(1)'
Calls: local ... update_cache -> update_cache_safe -> update_cache_binaries
In addition: Warning message:
In in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,  :
  You changed the working directory to /private/tmp/RtmpdCJdRv/regexcite (probably via setwd()). It will be restored to /Users/jenny/rrr/r-pkgs. See the Note section in ?knitr::knit

✓ Setting active project to '<no active project>'
Execution halted
Error in Rscript_render(f, render_args, render_meta, add1, add2) : 
  Failed to compile Whole-game.Rmd

I didn't really intend that rendering the book would install/update a package, so I'll go sort that out myself.

But just a reminder that there's still a condition length > 1 thing going on here. Like @henrikbengtsson, I've got env vars setup to surface this.

llrs commented 1 year ago

I think this (and #45) is fixed in https://github.com/r-lib/crancache/commit/fc51e313db93780b1efd870f1b6bd3b638c909d3. Thanks again!