[Rd] R CMD check . segfault on re-building vignettes

Sebastian Meyer Sebastian.Meyer at ifspm.uzh.ch
Mon Apr 30 17:48:38 CEST 2012

(Warning: There is some potential that this message is redundant.)

I think that i have spotted an issue with R CMD check that does not
trace back to a rare case, so it must have been reported already or i am
doing something stupid. However, to be sure and because I did not find
any comments on this while searching the R mailing lists, here is what i
  R CMD check .
from within a package source directory which has some vignettes in
inst/doc. When the check finally comes to
"checking re-building of vignette PDFs ..."
i get the following error

 *** caught segfault ***
address 0x7fff6073c998, cause 'memory not mapped'

 1: file.copy(pkgdir, vd2, recursive = TRUE)
 2: run_vignettes(desc)
 3: check_pkg(pkgdir, pkgname, pkgoutdir, startdir, libdir, desc,
is_base_pkg, is_rec_pkg, thispkg_subdirs, extra_arch)
 4: tools:::.check_packages()
aborting ...
Segmentation fault (core dumped)

as one can see, the error stems from the call
file.copy(pkgdir, vd2, recursive = TRUE)
in the run_vignettes function defined in the tools:::.check_packages
function. this call will copy the contents of "pkgdir" (the source
directory) to the ..Rcheck/vign_test/ directory _recursively_, the
problem of which being that the "..Rcheck" directory is part of
"pkgdir". Thus we get into a loop of copying pkgdir into
pkgdir/..Rcheck/vign_test, which is interrupted at some point by a
segfault (at least on my x86_64 GNU/Linux machine running Ubuntu 12.04
and R 2.15.0; the OS might be crucial for this issue).

I can reproduce the error by e.g.:

  pkgdir <- tempdir()
  file.create(file.path(pkgdir,"DESCRIPTION"))    # not necessary
  vd2 <- file.path(pkgdir,"..Rcheck/vign_test")
  dir.create(vd2, recursive=TRUE)
  ### Better Do NOT run -> buffer overflow
  # file.copy(pkgdir, vd2, recursive=TRUE)

Can anybody confirm this problem? Of course, a workaround is to run R
CMD check from outside the source directory (which is probably the
preferred way).

Thanks in advance,

Sebastian Meyer
Division of Biostatistics
Institute of Social and Preventive Medicine
University of Zurich

More information about the R-devel mailing list