From wdunlap at tibco.com  Tue Oct  6 02:40:53 2015
From: wdunlap at tibco.com (William Dunlap)
Date: Mon, 5 Oct 2015 17:40:53 -0700
Subject: [Rd] Error generated by .Internal(nchar) disappears when
	debugging
In-Reply-To: <56130E61.8060007@gmail.com>
References: <CAO1zAVYsOWG0QSVdU_wex-Y2U3KD3YEtGJu5nH5zNc8dCzm5ig@mail.gmail.com>
	<loom.20151006T011642-505@post.gmane.org> <56130E61.8060007@gmail.com>
Message-ID: <CAF8bMcZVihhK1No4mNG9a1Azp-EdAFbA7uD=JO4CQXch75aY9Q@mail.gmail.com>

I can reproduce the problem by running R-3.2.0 (on Windows),
installing copula from CRAN,
and then using it:

> install.packages("copula")
Installing package into 'C:/Program Files/R/R-3.2.0/site-library'
(as 'lib' is unspecified)
also installing the dependencies 'gsl', 'ADGofTest', 'pspline'

Warning: unable to access index for repository
http://bioconductor.org/packages/2.12/data/annotation/bin/windows/contrib/3.2
Warning: unable to access index for repository
http://bioconductor.org/packages/2.12/data/experiment/bin/windows/contrib/3.2
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/gsl_1.9-10.zip'
Content type 'application/zip' length 1121688 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ADGofTest_0.3.zip'
Content type 'application/zip' length 13378 bytes (13 KB)
downloaded 13 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/pspline_1.0-17.zip'
Content type 'application/zip' length 58343 bytes (56 KB)
downloaded 56 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/copula_0.999-13.zip'
Content type 'application/zip' length 3792158 bytes (3.6 MB)
downloaded 3.6 MB

package 'gsl' successfully unpacked and MD5 sums checked
package 'ADGofTest' successfully unpacked and MD5 sums checked
package 'pspline' successfully unpacked and MD5 sums checked
package 'copula' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\wdunlap\AppData\Local\Temp\RtmpeurJX7\downloaded_packages
> library(copula)
Warning message:
package 'copula' was built under R version 3.2.2
> fgmCopula(0.8)
Error in substr(sc[i], 2, nchar(sc[i]) - 1) :
  4 arguments passed to .Internal(nchar) which requires 3
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Oct 5, 2015 at 4:57 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 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



[Rd] Error generated by .Internal(nchar) disappears when debugging
William Dunlap