[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:
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. https://community-bioc.slack.com/archives/CLUJWDQF4/p1622062783020300?thread_ts=1622053611.008100&cid=CLUJWDQF4
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: _R_CHECK_LENGTH_1_LOGIC2_=verbose That one catches bugs where x && y or x || y is called with length(x)
1 or length(y) > 1.
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
is.na(files)
[1] FALSE FALSE
is.null(files)
[1] FALSE so, we have an x || y case with length(x) > 1. /Henrik
Thanks a lot in advance, Ulrich
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel