rcmdcheck icon indicating copy to clipboard operation
rcmdcheck copied to clipboard

`devtools::check()` creating warning that only contains `NULL`

Open rossdrucker opened this issue 3 years ago • 15 comments

I'm currently doing some work on a package, and calling devtools::check() is producing the following warning:

❯ checking Rd files ... WARNING
  NULL

However, when manually inspecting each of the .Rd files created by devtools::document() and re-reading the documentation, I don't see why this warning is appearing. I've run rcmdcheck::rcmdcheck() (which seems to be called by devtools::check() which doesn't produce the warning, and when I build and check the package from my terminal running

R CMD BATCH pkgname
R CMD CHECK pkgname_version.tar.gz

I don't get the warning either.

In terms of system setup, I've upgraded devtools to 2.4.4 and rcmdcheck to 1.4.0 and am running this on R 4.2.1. I don't have any reprex code since this seems to be happening when checking the entire directory, but this does seem to be reproducible by creating a new package project in RStudio (File > New Project > New Directory > R Package) and calling devtools::check() on the template package before changing any code.

I know it's only a warning and doesn't impact the functionality of the package, but I can't figure out where this is coming from. Happy to provide additional information as necessary as well.

Any help/insight would be greatly appreciated!

rossdrucker avatar Aug 04 '22 22:08 rossdrucker

Can you show us a package that reproduces this?

gaborcsardi avatar Aug 05 '22 06:08 gaborcsardi

Running devtools::check() on the package attached here produces the following output:

══ Building ═══════════════════════════════════════════════════════════════════════════
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
✔  checking for file ‘/Users/rossdrucker/Documents/reprexpkg/DESCRIPTION’ ...
─  preparing ‘reprexpkg’:
✔  checking DESCRIPTION meta-information
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘reprexpkg_0.1.0.tar.gz’
   
══ Checking ═══════════════════════════════════════════════════════════════════════════
Setting env vars:
• _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE
• _R_CHECK_CRAN_INCOMING_       : FALSE
• _R_CHECK_FORCE_SUGGESTS_      : FALSE
• NOT_CRAN                      : true
── R CMD check ────────────────────────────────────────────────────────────────────────
─  using log directory ‘/private/var/folders/zs/pmdcdv8j1pj62m1lj7rkbj500000gn/T/RtmpPlhN4V/reprexpkg.Rcheck’
─  using R version 4.2.1 (2022-06-23)
─  using platform: x86_64-apple-darwin17.0 (64-bit)
─  using session charset: UTF-8
─  using options ‘--no-manual --as-cran’
✔  checking for file ‘reprexpkg/DESCRIPTION’ ...
─  checking extension type ... Package
─  this is package ‘reprexpkg’ version ‘0.1.0’
─  package encoding: UTF-8
✔  checking package namespace information
✔  checking package dependencies (1.5s)
✔  checking if this is a source package
✔  checking if there is a namespace
✔  checking for executable files ...
✔  checking for hidden files and directories
✔  checking for portable file names
✔  checking for sufficient/correct file permissions ...
✔  checking serialization versions
✔  checking whether package ‘reprexpkg’ can be installed (1.5s)
✔  checking installed package size ...
✔  checking package directory ...
✔  checking for future file timestamps ...
✔  checking DESCRIPTION meta-information ...
✔  checking top-level files
✔  checking for left-over files
✔  checking index information
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded ...
✔  checking whether the package can be loaded with stated dependencies ...
✔  checking whether the package can be unloaded cleanly ...
✔  checking whether the namespace can be loaded with stated dependencies ...
✔  checking whether the namespace can be unloaded cleanly ...
✔  checking loading without being on the library search path ...
✔  checking dependencies in R code ...
✔  checking S3 generic/method consistency (563ms)
✔  checking replacement functions ...
✔  checking foreign function calls ...
✔  checking R code for possible problems (2.7s)
W  checking Rd files ...
   NULL
✔  checking Rd metadata ...
✔  checking Rd line widths ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries ...
✔  checking for code/documentation mismatches (515ms)
✔  checking Rd \usage sections (722ms)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking examples (656ms)
✔  checking for non-standard things in the check directory
✔  checking for detritus in the temp directory
   
   See
     ‘/private/var/folders/zs/pmdcdv8j1pj62m1lj7rkbj500000gn/T/RtmpPlhN4V/reprexpkg.Rcheck/00check.log’
   for details.
   
   
── R CMD check results ─────────────────────────────────────────── reprexpkg 0.1.0 ────
Duration: 12s

❯ checking Rd files ... WARNING
  NULL

0 errors ✔ | 1 warning ✖ | 0 notes ✔

and this is my sessionInfo() in case it is helpful:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3      urlchecker_1.0.1  pillar_1.8.0      compiler_4.2.1   
 [5] later_1.3.0       remotes_2.4.2     profvis_0.3.7     prettyunits_1.1.1
 [9] tools_4.2.1       pkgload_1.3.0     digest_0.6.29     pkgbuild_1.3.1   
[13] memoise_2.0.1     lifecycle_1.0.1   tibble_3.1.8      pkgconfig_2.0.3  
[17] rlang_1.0.4       shiny_1.7.1       cli_3.3.0         rstudioapi_0.13  
[21] curl_4.3.2        xopen_1.0.0       fastmap_1.1.0     stringr_1.4.0    
[25] withr_2.5.0       htmlwidgets_1.5.4 desc_1.4.1        fs_1.5.2         
[29] vctrs_0.4.1       devtools_2.4.4    rprojroot_2.0.3   glue_1.6.2       
[33] R6_2.5.1          processx_3.5.3    fansi_1.0.3       rcmdcheck_1.4.0  
[37] sessioninfo_1.2.2 purrr_0.3.4       callr_3.7.0       magrittr_2.0.3   
[41] whisker_0.4       promises_1.2.0.1  ps_1.7.0          ellipsis_0.3.2   
[45] htmltools_0.5.2   usethis_2.1.6     mime_0.12         xtable_1.8-4     
[49] httpuv_1.6.5      utf8_1.2.2        stringi_1.7.6     miniUI_0.1.1.1   
[53] cachem_1.0.6      crayon_1.5.1 

reprexpkg_0.1.0.tar.gz

Please let me know what other info would be useful, and/or if there's anything I can do to help.

rossdrucker avatar Aug 05 '22 07:08 rossdrucker

I am afraid this is an issue with base R:

❯ _R_CHECK_CRAN_INCOMING_REMOTE_=FALSE _R_CHECK_CRAN_INCOMING_=FALSE R CMD check --as-cran reprexpkg

[...]

* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... WARNING
NULL
* checking Rd metadata ... OK
* checking Rd line widths ... OK

[...]

* DONE

Status: 1 WARNING
See
  ‘/private/tmp/reprexpkg.Rcheck/00check.log’
for details.

gaborcsardi avatar Aug 05 '22 08:08 gaborcsardi

@gaborcsardi do you mind explaining what the issue is a bit more? Not sure I follow. Are you suggesting that the fix isn't in any package but rather in R 4.2.1?

rossdrucker avatar Aug 09 '22 20:08 rossdrucker

@gaborcsardi you mind explaining what the issue is a bit more? Not sure I follow.

I wish I could, but I don't know what the issue is.

Are you suggesting that the fix isn't in any package but rather in R 4.2.1?

Yes, since it also happens without the rcmdcheck package, and devtools.

gaborcsardi avatar Aug 09 '22 21:08 gaborcsardi

Gotcha, thanks. Is there somewhere to report the bug that I can report this to? Or just hope that 4.2.2 resolves the issue? I'm okay to ignore the note for now, but don't know if there's something else that it could affect that would be worth reporting

rossdrucker avatar Aug 10 '22 02:08 rossdrucker

Sure, you can report it to the R bug tracker if you like.

gaborcsardi avatar Aug 10 '22 06:08 gaborcsardi

I tried to report to the R bug tracker, but was told that this isn't an issue with R as it seems to come from a package:

Dear Ross,

A bug in one of several 10'000s of contributed R packages is not a bug in R.

--> https://www.r-project.org/bugs.html to learn more.

In trying to debug a bit more on my own, I've ran the code from devtools::check() and found that when running rcmdcheck::do_check() I do not get the warning.

rossdrucker avatar Aug 11 '22 08:08 rossdrucker

I can reproduce this without any packages, so it is probably a bug in base R. Can you please link to your bug report?

gaborcsardi avatar Aug 11 '22 11:08 gaborcsardi

I have this same issue, and the R bug tracker doesn't allow submission of bug reports by anyone who hasn't already submitted a report, requiring you to email someone to ask for access. It seems they're quick to send off a form rejection letter to anyone who sends something that looks like it might be a package bug....

dvg-p4 avatar Aug 12 '22 17:08 dvg-p4

Bug reported here

rossdrucker avatar Aug 12 '22 19:08 rossdrucker

Oddly enough, with a clean install of R, I can no longer reproduce this bug with R CMD check. macOS Monterey 12.4 (21F79), Apple M1 Pro.

(There were other incidental errors and warnings re: pdf and HTML manuals; I solved them by installing BasicTeX, installing the inconsolata and helvetic TeX packages with tlmgr: $ sudo tlmgr install inconsolata / helvetic, and installing a modern HTML tidy)

Will see if I can reprex with a clean devtools installation.

dvg-p4 avatar Aug 12 '22 19:08 dvg-p4

Nope, no errors warning or notes from devtools. @rossdrucker I'd recommend wiping your R installation (to do this in a way that you can revert, rename /Library/Frameworks/R.framework to /Library/Frameworks/bkp.R.framework) and redownloading R 4.2.1, Rstudio, and the minimal set of packages you need from Cran, and see if that makes the error go away like it did for me.

Edit: and the warning is also gone in the real package I actually wanted to document as well.

dvg-p4 avatar Aug 12 '22 19:08 dvg-p4

FWIW I am seeing this too.

jennybc avatar Aug 12 '22 21:08 jennybc

I have not been able to reproduce this, but it seems many here are seeing that strange NULL warning. It would be interesting to understand where this is coming from. AFAICS it means that the following call from within the extracted package source directory returns "NULL" instead of character(0):

tools:::R_runR('tools:::.check_package_parseRd(".")', "--vanilla --no-echo", tools:::setRlibs(suggests=TRUE))

Can you confirm this, @gaborcsardi ?

bastistician avatar Aug 25 '22 22:08 bastistician

@bastistician yeah, that's what I see. But looking at the source for tools:::.check_package_parseRd(), isn't that what it always returns?

hadley avatar Sep 19 '22 22:09 hadley

Although....

tools:::R_runR('invisible()', "--vanilla --no-echo")
#> character(0)
tools:::R_runR('invisible()', "--vanilla --no-echo", tools:::setRlibs(suggests=TRUE))
#> [1] "NULL"

hadley avatar Sep 19 '22 23:09 hadley

Turns out this is (was) a bug in rig, fixed in the new 0.5.2 version. You can reinstall the R version(s) you have this issue with using rig 0.5.2 and it should go away.

gaborcsardi avatar Sep 20 '22 09:09 gaborcsardi

Confirming this works; thanks for the fixes on this!

rossdrucker avatar Sep 25 '22 01:09 rossdrucker