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

BUG: install.packages("lambda.r") fails in R-devel w/ _R_CHECK_LENGTH_1_LOGIC2_=true #37

Closed
HenrikBengtsson opened this issue Mar 10, 2019 · 9 comments

Comments

@HenrikBengtsson
Copy link

In R-devel, there are now optional checks asserting that x && y is not called with length(x) > 1 or length(y) > 1. These checks can be enabled with _R_CHECK_LENGTH_1_LOGIC2_=true - I'll assume they'll eventually will be on by default. I guess that CRAN will enable them before that. I know that the CRAN incomin checks already have it enabled.

lambda.r produces:

Error in !is.na(line <- it()) && line$token != "SPECIAL" : 
  'length(x) = 9 > 1' in coercion to 'logical(1)'

already when installed.

Example

$ Rscript --version
R scripting front-end version 3.6.0 Under development (unstable) (2019-03-09 r76216)

$ _R_CHECK_LENGTH_1_LOGIC2_=true R --vanilla --quiet
> install.packages("lambda.r")
Installing package into/home/hb/R/x86_64-pc-linux-gnu-library/3.6’
(aslibis unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cloud.r-project.org/src/contrib/lambda.r_1.2.3.tar.gz'
Content type 'application/x-gzip' length 25559 bytes (24 KB)
==================================================
downloaded 24 KB

* installing *source* packagelambda.r...
** packagelambda.rsuccessfully unpacked and MD5 sums checked
** R
** byte-compile and prepare package for lazy loading
Error in !is.na(line <- it()) && line$token != "SPECIAL" : 
  'length(x) = 9 > 1' in coercion to 'logical(1)'
Error: unable to load R code in packagelambda.rExecution halted
ERROR: lazy loading failed for packagelambda.r* removing/home/hb/R/x86_64-pc-linux-gnu-library/3.6/lambda.r* restoring previous/home/hb/R/x86_64-pc-linux-gnu-library/3.6/lambda.rThe downloaded source packages are in/tmp/RtmpFG73rb/downloaded_packagesWarning message:
In install.packages("lambda.r") :
  installation of packagelambda.rhad non-zero exit status

Session info

> sessionInfo()
R Under development (unstable) (2019-03-09 r76216)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS: /home/hb/software/R-devel/trunk/lib/R/lib/libRblas.so
LAPACK: /home/hb/software/R-devel/trunk/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0    tcltk_3.6.0   
> 
@HenrikBengtsson
Copy link
Author

Hi @muxspace, is this repos/package still maintained? I haven't seen any activity in a while and I wonder if there's any chance this issue to get resolved. It's kind of a blocker downstream, e.g. when you try to run strict R CMD check on packages that dependent on lambda.r.

@muxspace
Copy link
Contributor

muxspace commented Sep 3, 2019

@HenrikBengtsson I didn't see this issue until now. I'll take a look and see about resolving it.

@HenrikBengtsson
Copy link
Author

Awesome. Thxs.

@HenrikBengtsson
Copy link
Author

Here are some more troubleshooting details:

$ _R_CHECK_LENGTH_1_LOGIC2_=verbose Rscript --vanilla -e 'install.packages("futile.logger", repos="https://cloud.r-project.org")'
Installing package into/home/alice/R/x86_64-pc-linux-gnu-library/3.6’
(aslibis unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/futile.logger_1.4.3.tar.gz'
Content type 'application/x-gzip' length 17456 bytes (17 KB)
==================================================
downloaded 17 KB

* installing *source* packagefutile.logger...
** packagefutile.loggersuccessfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
 ----------- FAILURE REPORT -------------- 
 --- failure: length > 1 in coercion to logical ---
 --- srcref --- 
: 
 --- package (from environment) --- 
lambda.r
 --- call from context --- 
NULL
 --- call from argument --- 
!is.na(line <- it()) && line$token != "SPECIAL"
 --- R stacktrace ---
where 1: parse_fun(it)
where 2: describe(fn, idx, raw = FALSE) %when% {
    raw
} %:=% {
    class(fn) <- NULL
    print(fn)
}
where 3: eval(exprs[i], envir)
where 4: eval(exprs[i], envir)
where 5: sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data)
where 6: doTryCatch(return(expr), name, parentenv, handler)
where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 8: tryCatchList(expr, classes, parentenv, handlers)
where 9: tryCatch(expr, error = function(e) {
    call <- conditionCall(e)
    if (!is.null(call)) {
        if (identical(call[[1L]], quote(doTryCatch))) 
            call <- sys.call(-4L)
        dcall <- deparse(call)[1L]
        prefix <- paste("Error in", dcall, ": ")
        LONG <- 75L
        sm <- strsplit(conditionMessage(e), "\n")[[1L]]
        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
        if (is.na(w)) 
            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 
                type = "b")
        if (w > LONG) 
            prefix <- paste0(prefix, "\n  ")
    }
    else prefix <- "Error : "
    msg <- paste0(prefix, conditionMessage(e), "\n")
    .Internal(seterrmessage(msg[1L]))
    if (!silent && isTRUE(getOption("show.error.messages"))) {
        cat(msg, file = outFile)
        .Internal(printDeferredWarnings())
    }
    invisible(structure(msg, class = "try-error", condition = e))
})
where 10: try(sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data))
where 11: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
where 12: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), 
    versionCheck = vI[[i]]), from = package)
where 13: loadNamespace(package = package, lib.loc = lib.loc, keep.source = keep.source, 
    keep.parse.data = keep.parse.data, partial = TRUE)
where 14: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
where 15: suppressPackageStartupMessages(loadNamespace(package = package, 
    lib.loc = lib.loc, keep.source = keep.source, keep.parse.data = keep.parse.data, 
    partial = TRUE))
where 16: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, 
    keep.parse.data = keep.parse.data, compress = compress, set.install.dir = set.install.dir)
where 17: tools:::makeLazyLoading("futile.logger", "/home/alice/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-futile.logger/00new", 
    keep.source = FALSE, keep.parse.data = FALSE, set.install.dir = "/home/alice/R/x86_64-pc-linux-gnu-library/3.6/futile.logger")

 --- value of length: 9 type: logical ---
  line1 col1 line2 col2   id parent token terminal text
2  TRUE TRUE  TRUE TRUE TRUE   TRUE  TRUE     TRUE TRUE
 --- function from context --- 
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Error in !is.na(line <- it()) && line$token != "SPECIAL" : 
  'length(x) = 9 > 1' in coercion to 'logical(1)'
Error: unable to load R code in packagelambda.rExecution halted
ERROR: lazy loading failed for packagefutile.logger* removing/home/alice/R/x86_64-pc-linux-gnu-library/3.6/futile.logger* restoring previous/home/alice/R/x86_64-pc-linux-gnu-library/3.6/futile.loggerThe downloaded source packages are in/tmp/alice/Rtmpr1kUbz/downloaded_packagesWarning message:
In install.packages("futile.logger", repos = "https://cloud.r-project.org") :
  installation of packagefutile.loggerhad non-zero exit status

@muxspace
Copy link
Contributor

Hi @HenrikBengtsson I pushed a fix to master. Can you check on your end that it works? If so, I'll submit it to CRAN.

@HenrikBengtsson
Copy link
Author

LGTM. Confirming. Thanks :)

@muxspace
Copy link
Contributor

It's on CRAN now

@HenrikBengtsson
Copy link
Author

HenrikBengtsson commented Sep 20, 2019 via email

@muxspace
Copy link
Contributor

No problem. Thanks for making enough noise so I could address it :)

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