rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

pandoc_available() function crashes on rhub "macos-m1-bigsur-release"

Open dmurdoch opened this issue 3 years ago • 4 comments

When running rhub::check(platform="macos-m1-bigsur-release") on a package that has an R Markdown vignette, the package check fails with a subscript out of bounds error. This appears to be a problem on rhub that rmarkdown is not protecting itself against.

Here's a copy of a post about it I just made to the R-package-devel mailing list:

I've localized the issue. In the function rmarkdown:::get_pandoc_version (here: https://github.com/rstudio/rmarkdown/blob/84dfc6674083f355d4f8c87dca8d85f85ca53bad/R/pandoc.R#L676-L693), they think they know a path to pandoc, and run "pandoc --version" to get the version number. It appears they get a zero length result, so line 683 gets the subscript out of bounds error and everything dies.

To reproduce, create a test package which imports rmarkdown and has this single line of R code:

 available <- rmarkdown::pandoc_available()

then submit that package to rhub using

 rhub::check(platform="macos-m1-bigsur-release")

It will fail with a message like this:

248#> * installing source package ‘testpkg3’ ...

249#> ** using staged installation

250#> ** R

251#> ** byte-compile and prepare package for lazy loading

252#> Error in strsplit(info, "\n")[[1]] : subscript out of bounds

253#> Error: unable to load R code in package ‘testpkg3’

254#> Execution halted

255#> ERROR: lazy loading failed for package ‘testpkg3’

256#> * removing ‘/Users/userDqIwNAjs/Rtemp/Rtmp6N8Dtr/Rinst146057d7e12c1/testpkg3’

dmurdoch avatar May 09 '22 19:05 dmurdoch

Thanks for the report. We'll look into that.

get_pandoc_version() should not be called when there is no pandoc, but will indeed be even if there is somehow a corrupt installation. We could protect agains that.

It could also be that pandoc --version does not return what we expect. @yihui do you have locally a m1 big sur to reproduce ?

cderv avatar May 09 '22 20:05 cderv

Regarding RHUB, it seems Pandoc has been installed now on these environment: https://github.com/r-hub/rhub/issues/509

cderv avatar May 09 '22 20:05 cderv

I doubt that the issue is with rmarkdown. It must be something weird in the R-hub check environment, because I also can't reproduce it as a normal user on that machine.

gaborcsardi avatar May 09 '22 20:05 gaborcsardi

If I followed the logic properly, the rmarkdown issue is simply that it assumes a program named pandoc will produce at least one line of output when running pandoc --version, and (possibly because of something weird in the R-hub environment) it doesn't.

dmurdoch avatar May 09 '22 20:05 dmurdoch