murdoch@stats.uwo.ca
2005-Dec-28 19:32 UTC
[Rd] .Call not counting parameters consistently (PR#8450)
The R_registerRoutines C function allows the number of parameters to a .Call function to be registered. For example, the tools package function md5sum() calls "Rmd5", which has been registered to require just one parameter. But if it is called with the wrong number of parameters, only the first error gets caught: > library(tools) > .Call("Rmd5",1,2,PACKAGE="tools") Error: Incorrect number of arguments (2), expecting 1 for Rmd5 > .Call("Rmd5",1,2,PACKAGE="tools") Error: argument 'files' must be character This happens in Windows versions of R-patched and R-devel. Charlie Geyer was bitten by this in his fuzzyRankTests package (version 0.3), which fails check because of it on Windows, but not on Unix. I haven't done any testing on Unix. I've traced into the do_dotcall function in src/main/dotcode.c, and I see that on the second call the "symbol.symbol.call" member is NULL, so no test is done, but I don't see why this is happening. The resolveNativeRoutine function does some strange stuff. Duncan Murdoch
Duncan Temple Lang
2005-Dec-28 20:01 UTC
[Rd] .Call not counting parameters consistently (PR#8450)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Coincidentally, I am in the process of working on a related aspect of symbol resolution. The issue is likely to be the caching of native symbols that we do. We do not cache the registration information, just the address of the routine. And so the test is not repeated. We can fix this, but it will make things more complex. This is a good example of where using the new mechanism within namespaces to resolve the symbols when the package is loaded and making them into regular R objects that are passed to .Call/.C/... makes things more rational. In that case, the caching is done in R and type information is more directly available. Off hand, I don't see why this would behave differently on Windows and Unix, so I'd appreciate if you could let us know the specific call that raises the error on Windows and not on Unix. D. murdoch at stats.uwo.ca wrote:> The R_registerRoutines C function allows the number of parameters to a > .Call function to be registered. For example, the tools package > function md5sum() calls "Rmd5", which has been registered to require > just one parameter. > > But if it is called with the wrong number of parameters, only the first > error gets caught: > > > library(tools) > > .Call("Rmd5",1,2,PACKAGE="tools") > Error: Incorrect number of arguments (2), expecting 1 for Rmd5 > > .Call("Rmd5",1,2,PACKAGE="tools") > Error: argument 'files' must be character > > This happens in Windows versions of R-patched and R-devel. Charlie > Geyer was bitten by this in his fuzzyRankTests package (version 0.3), > which fails check because of it on Windows, but not on Unix. I haven't > done any testing on Unix. > > I've traced into the do_dotcall function in src/main/dotcode.c, and I > see that on the second call the "symbol.symbol.call" member is NULL, so > no test is done, but I don't see why this is happening. The > resolveNativeRoutine function does some strange stuff. > > Duncan Murdoch > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel- -- Duncan Temple Lang duncan at wald.ucdavis.edu Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Building fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDsu8Q9p/Jzwa2QP4RAuqGAJ9oHP7lhmb7IN9c/3WoRL5qimCTSACfaNhr WFY6NLnh2dfDTOGcaStbgNo=rCZg -----END PGP SIGNATURE-----
ligges@statistik.uni-dortmund.de
2005-Dec-28 21:39 UTC
[Rd] .Call not counting parameters consistently (PR#8450)
Duncan Temple Lang wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Coincidentally, I am in the process of working on a related aspect of > symbol resolution. > > The issue is likely to be the caching of native symbols > that we do. We do not cache the registration information, > just the address of the routine. And so the test is not > repeated. We can fix this, but it will make things more > complex. This is a good example of where using the new mechanism > within namespaces to resolve the symbols when the package > is loaded and making them into regular R objects that > are passed to .Call/.C/... makes things more rational. > In that case, the caching is done in R and type information > is more directly available. > > > Off hand, I don't see why this would behave differently > on Windows and Unix, so I'd appreciate if you could let > us know the specific call that raises the error on Windows > and not on Unix.In principle, the code where this came up in the tests for the new CRAN package fuzzyRankTests is: library(fuzzyRankTests) set.seed(123) mu <- 0 x <- rnorm(10) y <- rnorm(10) + 1.5 try(.Call("fpvranksum", y, x, mu, "great", PACKAGE = "fuzzyRankTests")) Uwe> > D. > > > murdoch at stats.uwo.ca wrote: > >>The R_registerRoutines C function allows the number of parameters to a >>.Call function to be registered. For example, the tools package >>function md5sum() calls "Rmd5", which has been registered to require >>just one parameter. >> >>But if it is called with the wrong number of parameters, only the first >>error gets caught: >> >> > library(tools) >> > .Call("Rmd5",1,2,PACKAGE="tools") >>Error: Incorrect number of arguments (2), expecting 1 for Rmd5 >> > .Call("Rmd5",1,2,PACKAGE="tools") >>Error: argument 'files' must be character >> >>This happens in Windows versions of R-patched and R-devel. Charlie >>Geyer was bitten by this in his fuzzyRankTests package (version 0.3), >>which fails check because of it on Windows, but not on Unix. I haven't >>done any testing on Unix. >> >>I've traced into the do_dotcall function in src/main/dotcode.c, and I >>see that on the second call the "symbol.symbol.call" member is NULL, so >>no test is done, but I don't see why this is happening. The >>resolveNativeRoutine function does some strange stuff. >> >>Duncan Murdoch >> >>______________________________________________ >>R-devel at r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-devel > > > - -- > Duncan Temple Lang duncan at wald.ucdavis.edu > Department of Statistics work: (530) 752-4782 > 4210 Mathematical Sciences Building fax: (530) 752-7099 > One Shields Ave. > University of California at Davis > Davis, > CA 95616, > USA > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (Darwin) > > iD8DBQFDsu8Q9p/Jzwa2QP4RAuqGAJ9oHP7lhmb7IN9c/3WoRL5qimCTSACfaNhr > WFY6NLnh2dfDTOGcaStbgNo> =rCZg > -----END PGP SIGNATURE----- > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Reasonably Related Threads
- Patch to fix small bug in do_External and do_dotcall
- Problem with updating/reinstalling R under UBUNTU (Hardy)
- R2.2.1-patched build failed with PGI 6.1 on x86-64
- possibly stupid question about RPM building
- AIX 5.3 --enable-R-shlib --with-x ---with-iconv make error with R-2.7.0 and R-2.7.1