[R-SIG-Mac] Bug related to locale changes.

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jun 9 00:07:33 CEST 2015

On 08/06/2015 5:48 PM, MacQueen, Don wrote:
> Duncan,
> Would you (or someone) be able to test if this fixes a problem I found on
> Friday, that appeared shortly after I upgraded to 3.2.0 and reinstalled
> all my packages?

I can't test it, but it appears likely it would be related.  You should
be able to test it tomorrow.  I've added some inline comments to explain
why I think it's related.

> --------------------- example ---------------------
> [62]% R --vanilla
> R version 3.2.0 (2015-04-16) -- "Full of Ingredients"
> [... startup messages omitted ...]
> tmp.locale <- Sys.setlocale('LC_ALL','en_US.UTF-8')

This resets the string comparison code.  Currently the comparisons are
done relative to a locale, but the code to do that isn't initialized
until first use.

> require(xlsx)

This does a string comparison when it tries to figure out whether to
give a warning that the package was built under an obsolete version of
R.  That's the first string comparison after the locale change, and the
bug means it would return NA.  The problem was that the initialization
of the string comparison code set an irrelevant error code, and it
wasn't cleared, so the comparison code assumed an error occurred during
the comparison.

> Loading required package: xlsx
> Failed with error:  â

Not sure why you didn't get a more informative error message.  I guess
that's another bug, but it's not one I'm going to look into:  I've got a
talk to prepare...

> sessionInfo()
> R version 3.2.0 (2015-04-16)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.9.5 (Mavericks)
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/C
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> --------------------- end of example ---------------------
> Wheres if I load the package first, no problem.

In that case the string comparison works, so the package loads.  There
was probably an incorrect computation later when the string comparison
failed, but apparently that one was less serious.
> I reported it to the maintainer (Adrian Dragulescu) at that time, and he
> suggested that perhaps it was related. Earlier today I found the same
> pattern with respect to the xtable package.
> I apologize for not being in a position to do this test myself, but I'm
> not set up to readily build R from source on the Mac.

There should be nightly builds available tomorrow.

Duncan Murdoch

More information about the R-SIG-Mac mailing list