This is a bug/misfeature report for R CMD check. The function tools:::.check_packages_used_in_tests
Gives an apparently unintended error when checking the tests in the contributed package rcdd_1.1-3.tar.gz as found on CRAN. See the script below for details. The actual error reported is totally mysterious. * checking for unstated dependencies in tests ... NOTE Error in as.character(function (description = "", open = "", blocking = TRUE, : cannot coerce type 'closure' to vector of type 'character' Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted The error is apparently due to several of the test scripts using scan() which reads stuff from the script itself until an empty line is reached. This works fine (as one can see below, all the tests pass), but tools:::.check_packages_used_in_tests wants to parse each of the test scripts, and they don't parse. First, is this a bug? "Writing R Extensions" just says the contents of the tests directory should be [a-zA-Z]*.R files. It does not say they have to parse. Even if this is deemed a feature not a bug, it seems that "Writing R Extensions" should warn about this issue. Also tools:::.check_packages_used_in_tests should give a sane report about the issue, not a totally mysterious crash. Given the FIXME's and other comments in this function, it clearly needs more work. This issue should go on the todo list. I have rewritten the tests in rcdd so that they do not give this error, and will upload a new version when I get another bug resolved, but I think this issue could bite someone else. Hence should be fixed, somehow. ---------- here is a script showing the error ----------- ---------- the system is openSuSE Linux 11.3 ----------- Script started on Tue 04 Jan 2011 04:08:53 PM CST oak$ wget http://cran.r-project.org/src/contrib/rcdd_1.1-3.tar.gz --2011-01-04 16:09:51-- http://cran.r-project.org/src/contrib/rcdd_1.1-3.tar.gz Resolving cran.r-project.org... 137.208.57.37 Connecting to cran.r-project.org|137.208.57.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 598019 (584K) [application/x-gzip] Saving to: `rcdd_1.1-3.tar.gz' 0% [ ] 0 --.-K/s 2% [ ] 12,726 53.8K/s 7% [==> ] 47,478 92.4K/s 23% [========> ] 138,702 175K/s 52% [===================> ] 312,462 308K/s 100%[======================================>] 598,019 494K/s in 1.2s 2011-01-04 16:09:53 (494 KB/s) - `rcdd_1.1-3.tar.gz' saved [598019/598019] oak$ tar zxf rcdd_1.1-3.tar.gz oak$ R CMD check rcdd * using log directory ‘/HOME/faculty/charlie/tmp/Bugs/rcmdcheck/rcdd.Rcheck’ * using R version 2.12.1 (2010-12-16) * using platform: x86_64-unknown-linux-gnu (64-bit) * using session charset: UTF-8 * checking for file ‘rcdd/DESCRIPTION’ ... OK * this is package ‘rcdd’ version ‘1.1-3’ * checking package name space information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking for executable files ... OK * checking whether package ‘rcdd’ can be installed ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the name space can be loaded with stated dependencies ... OK * checking whether the name space can be unloaded cleanly ... OK * checking for unstated dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking for portable compilation flags in Makevars ... OK * checking for portable use of $BLAS_LIBS ... OK * checking examples ... OK * checking for unstated dependencies in tests ... NOTE Error in as.character(function (description = "", open = "", blocking = TRUE, : cannot coerce type 'closure' to vector of type 'character' Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted * checking tests ... Running ‘allfaces.R’ Comparing ‘allfaces.Rout’ to ‘allfaces.Rout.save’ ... OK Running ‘arith.R’ Comparing ‘arith.Rout’ to ‘arith.Rout.save’ ... OK Running ‘bar-gmp.R’ Comparing ‘bar-gmp.Rout’ to ‘bar-gmp.Rout.save’ ... OK Running ‘bar.R’ Comparing ‘bar.Rout’ to ‘bar.Rout.save’ ... OK Running ‘bug.R’ Comparing ‘bug.Rout’ to ‘bug.Rout.save’ ... OK Running ‘bug2.R’ Comparing ‘bug2.Rout’ to ‘bug2.Rout.save’ ... OK Running ‘chull.R’ Comparing ‘chull.Rout’ to ‘chull.Rout.save’ ... OK Running ‘chull2.R’ Comparing ‘chull2.Rout’ to ‘chull2.Rout.save’ ... OK Running ‘convert.R’ Comparing ‘convert.Rout’ to ‘convert.Rout.save’ ... OK Running ‘fred.R’ Comparing ‘fred.Rout’ to ‘fred.Rout.save’ ... OK Running ‘lpcdd.R’ Comparing ‘lpcdd.Rout’ to ‘lpcdd.Rout.save’ ... OK Running ‘oops.R’ Comparing ‘oops.Rout’ to ‘oops.Rout.save’ ... OK Running ‘qmatmult.R’ Comparing ‘qmatmult.Rout’ to ‘qmatmult.Rout.save’ ... OK Running ‘qux-gmp.R’ Comparing ‘qux-gmp.Rout’ to ‘qux-gmp.Rout.save’ ... OK Running ‘qux.R’ Comparing ‘qux.Rout’ to ‘qux.Rout.save’ ... OK Running ‘redund.R’ Comparing ‘redund.Rout’ to ‘redund.Rout.save’ ... OK Running ‘sammy.R’ Comparing ‘sammy.Rout’ to ‘sammy.Rout.save’ ... OK Running ‘subset.R’ Comparing ‘subset.Rout’ to ‘subset.Rout.save’ ... OK Running ‘zero.R’ Comparing ‘zero.Rout’ to ‘zero.Rout.save’ ... OK OK * checking package vignettes in ‘inst/doc’ ... OK * checking PDF version of manual ... OK oak$ ##### It checks o. k., but what about that NOTE ????? oak$ R --vanilla R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-unknown-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(tools) > tools:::.check_packages_used_in_tests("rcdd") Error in as.character(function (description = "", open = "", blocking = TRUE, : cannot coerce type 'closure' to vector of type 'character' > traceback() 8: sprintf(gettext(fmt, domain = domain), ...) 7: gettextf("parse error in file '%s':\n%s", file, .massage_file_parse_error_message(conditionMessage(e))) 6: stop(gettextf("parse error in file '%s':\n%s", file, .massage_file_parse_error_message(conditionMessage(e))), domain = NA, call. = FALSE) 5: value[[3L]](cond) 4: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 3: tryCatchList(expr, classes, parentenv, handlers) 2: tryCatch(parse(file = f, n = -1L), error = function(e) stop(gettextf("parse error in file '%s':\n%s", file, .massage_file_parse_error_message(conditionMessage(e))), domain = NA, call. = FALSE)) 1: tools:::.check_packages_used_in_tests("rcdd") > parse("rcdd/tests/bug2.R") Error in parse("rcdd/tests/bug2.R") : rcdd/tests/bug2.R:5:8: unexpected numeric constant 4: A <- matrix(scan(), byrow = TRUE, nrow = 9) 5: 0 1.000 ^ > q() oak$ exit Script done on Tue 04 Jan 2011 04:14:53 PM CST -- Charles Geyer Professor, School of Statistics University of Minnesota char...@stat.umn.edu ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel