From Martin.Morgan at roswellpark.org  Thu Oct  8 00:53:00 2015
From: Martin.Morgan at roswellpark.org (Morgan, Martin)
Date: Wed, 7 Oct 2015 22:53:00 +0000
Subject: [Rd] Error generated by .Internal(nchar) disappears when
 debugging
In-Reply-To: <aaeba58c8b8a4bbb816f39fadcdc674d@exchsrv2.sgc.loc>
References: <CAO1zAVYsOWG0QSVdU_wex-Y2U3KD3YEtGJu5nH5zNc8dCzm5ig@mail.gmail.com>
	<loom.20151006T011642-505@post.gmane.org> <56130E61.8060007@gmail.com>
	<aaeba58c8b8a4bbb816f39fadcdc674d@exchsrv2.sgc.loc>
Message-ID: <DF23DAC5A53912408040FF04D8B780AADF0FFC@EXMB3RSC.roswellpark.org>



> -----Original Message-----
> From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Cook,
> Malcolm
> Sent: Wednesday, October 07, 2015 3:52 PM
> To: 'Duncan Murdoch'; Matt Dowle; r-devel at stat.math.ethz.ch
> Subject: Re: [Rd] Error generated by .Internal(nchar) disappears when
> debugging
> 
> What other packages do you have loaded?  Perhaps a BioConductor one that
> loads S4Vectors that announces upon load:
> 
> 	Creating a generic function for 'nchar' from package 'base' in package
> 'S4Vectors'

This was introduced as a way around the problem, where the declaration of a method was moved to the .onLoad hook

.onLoad <- function(libname, pkgname)
     setMethod("nchar", "Rle", .nchar_Rle)

instead of in the body of the package. The rationale was that the method is then created at run-time, when the generic is defined on the user's R, rather than at compile time, when the generic is defined on the build system's R. There was a subsequent independent report that this did not solve the problem, but we were not able to follow up on that.

This is only defined in the current release version of S4Vectors, which is the only version expected to straddle R versions with different signatures.

Martin Morgan

> 
> Maybe a red herring...
> 
> ~Malcolm
> 
>  > -----Original Message-----
>  > From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of
> Duncan  > Murdoch  > Sent: Monday, October 05, 2015 6:57 PM  > To: Matt
> Dowle <mattjdowle at gmail.com>; r-devel at stat.math.ethz.ch  > Subject: Re:
> [Rd] Error generated by .Internal(nchar) disappears when  > debugging  >  >
> On 05/10/2015 7:24 PM, Matt Dowle wrote:
>  > > Joris Meys <jorismeys <at> gmail.com> writes:
>  > >
>  > >>
>  > >> Hi all,
>  > >>
>  > >> I have a puzzling problem related to nchar. In R 3.2.1, the internal  > >
> nchar  > >> gained an extra argument (see  > >>
> https://stat.ethz.ch/pipermail/r-announce/2015/000586.html)
>  > >>
>  > >> I've been testing code using the package copula, and at home I'm  > >>
> still running R 3.2.0 (I know, I know...). When trying the following  > >> code, I
> > > got  > >> an error:
>  > >>
>  > >>> library(copula)
>  > >>> fgmCopula(0.8)
>  > >> Error in substr(sc[i], 2, nchar(sc[i]) - 1) :
>  > >>   4 arguments passed to .Internal(nchar) which requires 3
>  > >>
>  > >> Cheers
>  > >> Joris
>  > >
>  > >
>  > > I'm seeing a similar problem. IIUC, the Windows binary .zip from CRAN  >
> > of any package using base::nchar is affected. Could someone check my  > >
> answer here is correct please :
>  > > http://stackoverflow.com/a/32959306/403310
>  >
>  > Nobody has posted a simple reproducible example here, so it's kind of
> hard to  > say.
>  >
>  > I would have guessed that a change to the internal signature of the C code
> > underlying nchar() wouldn't have any effect on a package that called the R
> > nchar() function.
>  >
>  > When I put together my own example (a tiny package containing a
> function  > calling nchar(), built to .zip using R 3.2.2, installed into R 3.2.0), it
> confirmed  > my guess.
>  >
>  > On the other hand, if some package is calling the .Internal function directly,
> I'd  > expect that to break.  Packages shouldn't do that.
>  >
>  > So I'd say there's been no evidence posted of a problem in R here, though
> > there may be problems in some of the packages involved.  I'd welcome an
> > example that provided some usable evidence.
>  >
>  > Duncan Murdoch
>  >
>  > ______________________________________________
>  > R-devel at r-project.org mailing list
>  > https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.


[Rd] Error generated by .Internal(nchar) disappears when debugging
Morgan, Martin