[Rd] R_CMethodDef incompatibility (affects R_registerRoutines)

William Dunlap wdunlap at tibco.com
Tue Apr 25 22:28:24 CEST 2017


I recently noticed a change between R-3.3.3 and R-3.4.0 in the definition
of the R_CMethodDef struct.
  typedef struct {
      const char *name;
      DL_FUNC     fun;
      int         numArgs;
-
      R_NativePrimitiveArgType *types;
-     R_NativeArgStyle         *styles;
-
  } R_CMethodDef;

I suspect this is the reason that packages installed by R-3.4.0 and loaded
into R-3.3.3 will crash the latter if the package registers routines to be
called from .C or .Fortran:
% R-3.3.3 --quiet
> library(sp, lib.loc=c("/home/R/R-3.4.0/lib64/R/site-library"))

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

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(package, lib.loc)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if
(!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))
        call <- sys.call(-4L)        dcall <- deparse(call)[1L]
 prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <-
conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L
+ nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))
            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
    type = "b")        if (w > LONG)             prefix <- paste0(prefix,
"\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix,
conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if
(!silent && identical(getOption("show.error.messages"),         TRUE)) {
     cat(msg, file = stderr())        .Internal(printDeferredWarnings())
 }    invisible(structure(msg, class = "try-error", condition = e))})
 8: try({    attr(package, "LibPath") <- which.lib.loc    ns <-
loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos,
deps)})
 9: library(sp, lib.loc = c("/home/R/R-3.4.0/lib64/R/site-library"))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

Was removing the R_NativeArgStyle field intended?

Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]



More information about the R-devel mailing list