[Rd] Segmentation fault in .Call() (PR#4761)

Duncan Temple Lang duncan at research.bell-labs.com
Sat Oct 25 00:01:55 MEST 2003


jerome at hivnet.ubc.ca wrote:
> Full_Name: Jerome Asselin
> Version: 1.8.0
> OS: RedHat Linux 7.2
> Submission from: (NULL) (142.103.177.13)
> 
> 
> 
> I would not expect a segmentation fault; perhaps an error message.
> 
> > .Call("log")
> Segmentation fault
> 
> This is always reproducable for me.

Thanks for the info.  This should definitely not cause a segfault.
However, the explanation means that the cure is not obvious without
upsetting quite a lot of people.  Let me explain what happens.

Without the PACKAGE argument in the .Call(), we look for the symbol
"log" by walking through the array of previously loaded DLLs/shared
libraries.  Many of the standard packages use registration of the
routines that are to be called by R via the
.C/.Call/.Fortran/.External interaces. However, they also permit the
DLL to be searched using regular dynamic lookup.  This is the default
so as not to break anyone's S code that uses non-registered routines.
And this is what causes the problem!  In my case, we first look in the
methods library (although this is not important) and as for the symbol
"log". And we find it there on Linux.  Precisely why is very much
system-dependent and installation depdenent.  

Peforming the dynamic lookup is the problem.  If everyone were to use
registration, then we could turn this off, but that is a little too
much to ask (currently :-)).  If you had asked for a different symbol
and not something that was in the system libraries, the result would
have been better.

This did reveal a bug in that the base library has the dynamic lookup
turned on which it should not.  Trivial fix in progress.

I doubt too many people will get into this particular situation, so I
am not certain the fix is better than the event of small
probability. Opinions?

Thanks,

 D.

 


> 
> Sincerely,
> Jerome Asselin
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

-- 
_______________________________________________________________

Duncan Temple Lang                duncan at research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       
         http://cm.bell-labs.com/stat/duncan



More information about the R-devel mailing list