Thank you, but can we see the patch please (no attachement arrived)?

On Sat, 27 Dec 2008, Olaf Mersmann wrote:

I've stumbled upon a small bug/inconsitency in do_External and do_dotcall:

Here's an example:

 % LC_ALL=C R  --vanilla < symname-bug.R

 R version 2.8.0 (2008-10-20)
 *snip*
 > options(error=expression(0))
 > ## Call 'R_GD_nullDevice' with incorrect parameter count:
 > .Call("R_GD_nullDevice", 1)
 Error in .Call("R_GD_nullDevice", 1) :
   Incorrect number of arguments (1), expecting 0 for R_GD_nullDevice
 >
 > ## Same call made via a NativeSymbolInfo object:
 > sym <- getDLLRegisteredRoutines("grDevices")$.Call[["R_GD_nullDevice"]]
 > .Call(sym$address, 1)
 Error: 'getEncChar' must be called on a CHARSXP

The error stems from the fact, that both do_External and do_dotcall
expect CAR(args) to be a string, while it might be a NativeSymbolInfo
object. checkValidSymbolId() already handles this, so the fix is to
use the symbol name returned from resolveNativeRoutine().

After applying the attached patch (against R-trunk revision 47348) the
output looks like this:

 % LC_ALL=C bin/R  --vanilla < symname-bug.R

 R version 2.9.0 Under development (unstable) (2008-12-26 r47348)
 *snip*
 > options(error=expression(0))
 > ## Call 'R_GD_nullDevice' with incorrect parameter count:
 > .Call("R_GD_nullDevice", 1)
 Error in .Call("R_GD_nullDevice", 1) :
   Incorrect number of arguments (1), expecting 0 for R_GD_nullDevice
 >
 > ## Same call made via a NativeSymbolInfo object:
 > sym <- getDLLRegisteredRoutines("grDevices")$.Call[["R_GD_nullDevice"]]
 > .Call(sym$address, 1)
 Error in .Call(sym$address, 1) :
   Incorrect number of arguments (1), expecting 0 for R_GD_nullDevice

Greetings from Dortmund
Olaf


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to