ropensci / bibtex

bibtex parser for R
https://docs.ropensci.org/bibtex/
35 stars 12 forks source link

caught segfault read.bib() - macOS 10.14.6 #23

Closed RLumSK closed 4 years ago

RLumSK commented 4 years ago

Issue

Description

Today, suddenly I got various fatal crashes of my R sessions (e.g., while using the package 'RefManageR' and 'vitae') which I tracked down to the update of 'bibtex' to version 0.4.2.1 (released on CRAN 2019-12-20), which leads to the following error message:

caught segfault address 0x0, cause 'memory not mapped'

Traceback: 1: doTryCatch(return(expr), name, parentenv, handler) 2: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 3: tryCatchList(expr, classes, parentenv, handlers) 4: tryCatch(.External("do_read_bib", file = file, encoding = encoding, srcfile = srcfile), error = function(e) { if (!any(grepl("unprotect_ptr", e))) stop(geterrmessage(), call. = FALSE) else stop("Invalid bib file", call. = FALSE)}) 5: withCallingHandlers(tryCatch(.External("do_read_bib", file = file, encoding = encoding, srcfile = srcfile), error = function(e) { if (!any(grepl("unprotect_ptr", e))) stop(geterrmessage(), call. = FALSE) else stop("Invalid bib file", call. = FALSE)}), warning = function(w) { if (any(grepl("syntax error, unexpected [$]end", w))) invokeRestart("muffleWarning")})

Remarks

Running Example

Example BIB-file

@article{Hawking1966,
  author = {Hawking, Stephen William  and Bondi, Hermann },
  title = {The occurrence of singularities in cosmology},
  journal = {Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences},
  volume = {294},
  number = {1439},
  pages = {511-521},
  year = {1966},
  doi = {10.1098/rspa.1966.0221},
}

R call

bibtex::read.bib("test.bib")

Session info

R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

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

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

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

loaded via a namespace (and not attached):
[1] compiler_3.6.2 magrittr_1.5   tools_3.6.2    stringi_1.4.3  stringr_1.4.0  bibtex_0.4.2.1

Update (2019-12-24)

Now I see that also the CRAN tests for macOS fail, so I guess the problem is real and not related to a particular configuration. However, help is at hand #24 and will probably available once the CRAN is back from vacation.

pat-s commented 4 years ago

Same here.

clang 7 R 3.6.2 macOS Mojave (10.14.6)

.R/Makevars:

CXX_STD = CXX14

CC=ccache /usr/local/clang7/bin/clang
CC11=ccache /usr/local/clang7/bin/clang
CC14=ccache /usr/local/clang7/bin/clang
CXX=ccache /usr/local/clang7/bin/clang++
CXX11=ccache /usr/local/clang7/bin/clang++
CXX14=ccache /usr/local/clang7/bin/clang++

# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
# clang: end
mtmorgan commented 4 years ago

'me to' for several Bioconductor packages during R CMD build, e.g., http://bioconductor.org/checkResults/devel/bioc-LATEST/BEclear/celaya2-install.html presumably this is causing havoc for CRAN as well...

hpages commented 4 years ago

Also worth noting that the CRAN checks for bibtex 0.4.2.1 also show a segfault for read.bib() on OS X but surprisingly that didn't stop bibtex 0.4.2.1 from being published: https://www.r-project.org/nosvn/R.check/r-release-osx-x86_64/bibtex-00check.html

pat-s commented 4 years ago

ping @romainfrancois

pat-s commented 4 years ago

Seems unrelated to the compiler used, also crashes for me when using gcc.

Edit: As a workaround, installing the "dev" version (which is not actually dev because it still is at v0.4.2) solves the "upgrading" issue when using ´remotes::update_packages()`.

I.e. remotes::install_github("romainfrancois/bibtex") and the package will stay at v0.4.2 when you are calling remotes::update_packages().

RLumSK commented 4 years ago

A new version (0.4.2.2) of 'bibtex' was just released on CRAN. I tested my example from above again and now it works, thus thanks to @romainfrancois for the fix!