Skip to content
Prev 18206 / 21312 Next

[Bioc-devel] Build error "failure: length > 1 in coercion to logical" not reproducible

On Thu, Jun 17, 2021 at 2:32 AM <bodenhofer at bioinf.jku.at> wrote:
Not a Bioc maintainer, but yes, the Bioc build system added this on
May 22, 2021 in order to catch similar bugs in package vignettes, cf.
https://community-bioc.slack.com/archives/CLUJWDQF4/p1622062783020300?thread_ts=1622053611.008100&cid=CLUJWDQF4
You want to set:

_R_CHECK_LENGTH_1_LOGIC2_=verbose

That one catches bugs where x && y or x || y is called with length(x)
Using:

_R_CHECK_LENGTH_1_CONDITION_=verbose

catches bugs where if (x) { ... } and similar conditions are called
with length(x) > 1.

In your case, a reproducible minimal example is:

Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_"="verbose")
files <- c("a", "b")
files <- Rsubread:::.check_and_NormPath(files)
...
Error in is.na(files) || is.null(files) :

  'length(x) = 2 > 1' in coercion to 'logical(1)'

The problem is that there's a is.na(files) || is.null(files) in the code, where
[1] FALSE FALSE
[1] FALSE

so, we have an x || y case with length(x) > 1.

/Henrik