From maechler at stat.math.ethz.ch  Wed Dec  6 11:29:39 2017
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Wed, 6 Dec 2017 11:29:39 +0100
Subject: [Rd] FW: R-devel error
In-Reply-To: <BY2PR09MB0293D6F3EDCE2DF3EFC57403EC3D0@BY2PR09MB0293.namprd09.prod.outlook.com>
References: <BY2PR09MB0293D6F3EDCE2DF3EFC57403EC3D0@BY2PR09MB0293.namprd09.prod.outlook.com>
Message-ID: <23079.50835.483974.112384@stat.math.ethz.ch>

>>>>> Pearce, Robert <Pearce.Robert at epa.gov>
>>>>>     on Tue, 5 Dec 2017 21:31:09 +0000 writes:

    > I am resubmitting this bug report but with additional information. I am running this with windows 10:  w64-mingw32 with R Under development (unstable) (2017-12-04 r73829). 

There is no such message (as you cite below) in the R-devel archives:
      https://stat.ethz.ch/pipermail/r-devel/2017-November/thread.html

Hence it was never posted for some reason
(You may have *sent* it, but it never arrived "safely")


    > I build 'httk' from the command prompt using 'R CMD build httk' after installing the required packages. Then when the vignettes are being created, it crashes. Today I installed the latest versions of Rtools, MikTex and R-devel and still got the same error. We have also replicated this on another machine. I am able to successfully build the package in this way with R 3.4.3.

> Robert

To make this reproducible, indeed, I also get 
problem, possibly the same as you on my Linux machine (Fedora 26):

1. Get  httk_1.7.tar.gz from https://cran.r-project.org/package=httk

2. unpack (for me:)
	tar xf httk_1.7.tar.gz
3.
	R-devel CMD build httk   

I get the following.
Notably after having waited several minutes at the prompt
(line  of output):

 '* creating vignettes ' 

  ------------------------------------------------------------------------
  [nfslocal at lynne tmp]$ R-devel CMD build httk
  * checking for file ?httk/DESCRIPTION? ... OK
  * preparing ?httk?:
  * checking DESCRIPTION meta-information ... OK
  * cleaning src
  * installing the package to process help pages
  * saving partial Rd database
  * creating vignettes ...sh: line 1: 16259 Segmentation fault      (core dumped) '/u/maechler/R/D/r-devel/inst/bin/Rscript' --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)" > '/tmp/RtmpV1grVw/xshell3e793c7d5258' 2>&1
   ERROR

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

  Traceback:
   1: .Call(C_stri_locate_all_regex, str, pattern, omit_no_match, opts_regex)
   2: stri_locate_all_regex(string, pattern, omit_no_match = TRUE,     opts_regex = opts)
   3: stringr::str_locate_all(input, inline.code)
   4: parse_inline(g, patterns)
   5: FUN(X[[i]], ...)
   6: lapply(groups, function(g) {    block = grepl(chunk.begin, g[1])    if (!set.preamble && !parent_mode()) {        return(if (block) "" else g)    }    if (block) {        n = length(g)        if (n >= 2 && grepl(chunk.end, g[n]))             g = g[-n]        g = strip_block(g, patterns$chunk.code)        params.src = if (group_pattern(chunk.begin)) {            stringr::str_trim(gsub(chunk.begin, "\\1", g[1]))        }        else ""        parse_block(g[-1], g[1], params.src)    }    else parse_inline(g, patterns)})
   7: split_file(lines = text)
   8: process_file(text, output)
   9: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet,     encoding = encoding)
  10: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv())
  11: vweave_rmarkdown(...)
  12: engine$weave(file, quiet = quiet, encoding = enc)
  13: doTryCatch(return(expr), name, parentenv, handler)
  14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  15: tryCatchList(expr, classes, parentenv, handlers)
  16: tryCatch({    engine$weave(file, quiet = quiet, encoding = enc)    setwd(startdir)    find_vignette_product(name, by = "weave", engine = engine)}, error = function(e) {    stop(gettextf("processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)), domain = NA, call. = FALSE)})
  17: tools::buildVignettes(dir = ".", tangle = TRUE)
  An irrecoverable exception occurred. R is aborting now ...
  [nfslocal at lynne tmp]$ 
  ------------------------------------------------------------------------


I've seen this (segfault, triggered from stringr stuff) before,
occasionally and always thought it was a consequence of a messup
(different R versions and package installations in libraries I
use on the same computer....),  but now I have convinced myself
that this is not the case: I can easily reproduce the above using

       tools::buildVignettes(dir = "<mypath_to>/httk")

==> So I'd suggest there's a pretty low-level bug somewhere.

- Either in 'stringr' or 'stringi' in their C code using
  things they should not (because not in R's API),
  which now shows in R-devel where many "inner workings" have been
  modified (key "ALTREP")

- or in R-devel .. in these new "inner workings".


I don't have time to dig further at the moment.

Thank you, Robert, for your report!

Martin Maechler,
ETH Zurich


    > From: Pearce, Robert
    > Sent: Monday, November 20, 2017 11:32 AM
    > To: 'r-devel at r-project.org' <r-devel at r-project.org>
    > Subject: R-devel error


    > Hello,

    > During the last week I've been getting an error with r-devel when building the source package for 'httk'. Everything works fine until: 'creating vignettes...' . Then I get a pop-up stating: 'R for Windows front-end has stopped working... close the program'. I have installed the latest version of R, and this error does not occur.

    > Robert Pearce



[Rd] FW: R-devel error
Martin Maechler