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

Henrik Bengtsson henr|k@bengt@@on @end|ng |rom gm@||@com
Thu Jun 17 17:21:29 CEST 2021

On Thu, Jun 17, 2021 at 2:32 AM <bodenhofer using bioinf.jku.at> wrote:
> Dear colleagues,
> It seems to me that, starting with the latest BioC devel branch (3.14), the
> build systems have become more pedantic about logical vectors of length > 1
> in conditions. Two of the packages I am maintaining, 'kebabs' and 'procoil'
> currently fail to build. Surely I want to fix this. However, I cannot
> reproduce these errors on my local system (R 4.1.0 alpha on Ubuntu 18.04
> LTS). The discussions https://support.bioconductor.org/p/9137605/ and
> https://github.com/Bioconductor/BBS/issues/71  have pointed me to the
> setting "_R_CHECK_LENGTH_1_CONDITION_=verbose".
> First question: Can anybody confirm that this has been changed in the recent
> devel?

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.

> Second question: I have tried to include
> "_R_CHECK_LENGTH_1_CONDITION_=verbose" in my .Renviron file and it seems
> that my R session respects that. However, when I run 'R CMD build' on the
> aforementioned packages, they still build fine. The suggestions in
> https://github.com/Bioconductor/BBS/issues/71 don't work for me either
> (maybe I have done something wrong). I would actually like to reproduce the
> errors in my local system, since this will help me fixing the errors and
> testing the changes. So can anybody give me advice how I can make my local
> installation to check for logical vectors of length > 1 in conditions more
> strictly?

You want to set:


That one catches bugs where x && y or x || y is called with length(x)
> 1 or length(y) > 1.



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

In your case, a reproducible minimal example is:

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

> is.na(files)
> is.null(files)

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


> Thanks a lot in advance,
> Ulrich
> _______________________________________________
> Bioc-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list