[R] does segfault mean (always) a bug?

Martin Maechler maechler at lynne.stat.math.ethz.ch
Wed May 6 10:32:20 CEST 2015


>>>>> Duncan Murdoch <murdoch.duncan at gmail.com>
>>>>>     on Tue, 5 May 2015 15:36:59 -0400 writes:

    > On 05/05/2015 2:54 PM, lejeczek wrote:
    >> hi eveybody
    >> 
    >> I'm trying something simple (Biocunductor packages), so 
    >> simple I believe it's example from docs but I get segfault.
    >> I don't suppose incorrect scripting can cause segfault, right?

    > In R, a segfault always indicates a bug.  What's not so clear is whether
    > it is a bug in R, a bug in a contributed package, or a bug in some
    > underlying system library.

    > If you can only trigger the bug when using a Bioconductor package, then
    > the first guess is that it is that package, and the maintainer of that
    > package is in the best position to track it down further.  If you can
    > simplify the code to trigger it without using any contributed packages,
    > then it could well be a bug in R, and we'd like to see code to reproduce it.
    > Duncan Murdoch

The bug Duncan mentions can also be in the user's R code, outside any package:

If a user does what (s)he should never do, namely directly call
.C(), .Fortran(), .Call() or similar (.Internal(), .External(),..)
it is typically easy to trigger segfaults, and then the bug is
in the user's R code.

Variations of the above involve using the inline package, or
other interfaces to C/C++/... code, libraries, etc: The bug may be in
your code rather than the underlying code which is allowed to
make strong assumptions about how it is called.

Martin Maechler



More information about the R-help mailing list