From murdoch.duncan at gmail.com  Mon Jun  8 02:46:00 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sun, 07 Jun 2015 20:46:00 -0400
Subject: [Rd] Bug in loadNamespace?
Message-ID: <5574E5C8.1010902@gmail.com>

I am seeing very strange behaviour in R 3.2.0 patched (r68272) and a new
build of R-devel.  The sessioninfo() from the former is below.

Here's what I see:  If I set the locale, and trigger a namespace load, a
version comparison gives NA, and I get an error.  For example, in a new
session started with R --vanilla from the terminal:

> Sys.setlocale(locale='en_US.UTF-8');grid::gpar()
[1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_CA.UTF-8"
Error in if (R_version_built_under < "3.0.0") stop(gettextf("package %s
was built before R 3.0.0: please re-install it",  :
  missing value where TRUE/FALSE needed

I've tried debugging this, and the bad lines are these, in loadNamespace:

R_version_built_under <- as.numeric_version(built$R)
if (R_version_built_under < "3.0.0") stop(gettextf("package %s was built
before R 3.0.0: please re-install it",
    sQuote(basename(pkgpath))), call. = FALSE, domain = NA)

These are in the src/library/base/R/namespace.R file, around line 379.

If I stop it before the if and evaluate R_version_built_under, it looks
fine.  If I stop it there and evaluate

R_version_built_under < "3.0.0"

I get NA.  If I evaluate it again without changing anything, I get FALSE.

Does anyone else see this?  Any ideas on what might be the cause?


> sessionInfo()
R version 3.2.0 Patched (2015-04-28 r68272)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


Duncan Murdoch



[Rd] Bug in loadNamespace?
Duncan Murdoch