From pdalgd at gmail.com  Mon Jun  8 13:20:09 2015
From: pdalgd at gmail.com (peter dalgaard)
Date: Mon, 8 Jun 2015 13:20:09 +0200
Subject: [Rd] Bug in loadNamespace?
In-Reply-To: <22894BD8-977F-4F5F-9CE2-1EF5B40268E9@helsinki.fi>
References: <5574E5C8.1010902@gmail.com>
	<21876.60531.689839.424259@max.nulle.part>
	<5574F303.4080903@gmail.com>
	<F35FE433-FCF9-49DC-A4D1-8ECA2985D7DB@gmail.com>
	<22894BD8-977F-4F5F-9CE2-1EF5B40268E9@helsinki.fi>
Message-ID: <6F995B2F-B182-4523-B995-D3A1A513A308@gmail.com>

Looks like this could be locale related. Both of you are using non-US locales, and Sys.setlocale is not changing the last entry (LC_MESSAGES), which is as documented, but maybe somehow related. 

I can reproduce with

Peters-iMac:r-release-branch pd$ LC_ALL=da_DK.UTF-8 BUILD-dist/bin/R --vanilla

R version 3.2.1 beta (2015-06-07 r68485) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0/x86_64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> Sys.setlocale(locale='en_US.UTF-8')
[1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/da_DK.UTF-8"
> "320" > "300"
[1] NA


On 08 Jun 2015, at 11:10 , Reijo Sund <reijo.sund at helsinki.fi> wrote:

> Hi!
> 
> Yes, I can repeat the problem. Happens at least with Mavericks build of R 3.1.3 (2015-03-09) as well as with Mavericks as well as Snowleopard builds of R 3.2.1 beta (2015-06-07 r68485).
> 
> Best wishes,
> Reijo
> 
> - - -
> 
> R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> 
>> Sys.setlocale(locale='en_US.UTF-8')
> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/fi_FI.UTF-8"
>> "320" > "300"
> [1] NA
>> "320" > "300"
> [1] TRUE
> 
> - - -
> 
> R version 3.2.1 beta (2015-06-07 r68485) -- "World-Famous Astronaut"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> 
>> Sys.setlocale(locale='en_US.UTF-8')
> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/fi_FI.UTF-8"
>> "320" > "300"
> [1] NA
>> "320" > "300"
> [1] TRUE
> 
> - - -
> 
> R version 3.2.1 beta (2015-06-07 r68485) -- "World-Famous Astronaut"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> 
>> Sys.setlocale(locale='en_US.UTF-8')
> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/fi_FI.UTF-8"
>> "320" > "300"
> [1] NA
>> "320" > "300"
> [1] TRUE
> 
> 
> 
> 
>> peter dalgaard <pdalgd at gmail.com> kirjoitti 8.6.2015 kello 11.14:
>> 
>> Not happening for me with
>> 
>> R version 3.2.0 Patched (2015-06-05 r68479) -- "Full of Ingredients"
>> ...
>> 
>>> Sys.setlocale(locale='en_US.UTF-8')
>> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8"
>>> "320"> "300"
>> [1] TRUE
>>> "320"> "300"
>> [1] TRUE
>>> 
>> 
>> -pd
>> 
>>> On 08 Jun 2015, at 03:42 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>>> 
>>> On 07/06/2015 9:14 PM, Dirk Eddelbuettel wrote:
>>>> 
>>>> On 7 June 2015 at 20:46, Duncan Murdoch wrote:
>>>> | 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?
>>>> 
>>>> I don't see it on Ubuntu with a fresh R-devel:
>>>> 
>>>> edd at max:~/svn/r-devel$ RD
>>>> 
>>>> R Under development (unstable) (2015-06-06 r68485) -- "Unsuffered Consequences"
>>>> Copyright (C) 2015 The R Foundation for Statistical Computing
>>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>> 
>>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>>> You are welcome to redistribute it under certain conditions.
>>>> Type 'license()' or 'licence()' for distribution details.
>>>> 
>>>> Natural language support but running in an English locale
>>>> 
>>>> R is a collaborative project with many contributors.
>>>> Type 'contributors()' for more information and
>>>> 'citation()' on how to cite R or R packages in publications.
>>>> 
>>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>>> 'help.start()' for an HTML browser interface to help.
>>>> Type 'q()' to quit R.
>>>> 
>>>> R> Sys.setlocale(locale='en_US.UTF-8');grid::gpar()
>>>> [1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
>>>> list()
>>>> R> 
>>>> 
>>>> I don't have r-patched handy or I'd try that too.
>>> 
>>> Thanks.  It doesn't actually need loadNamespace, it's string comparisons
>>> that fail.  For example,
>>> 
>>> $ R --vanilla
>>> 
>>> R version 3.2.0 Patched (2015-04-28 r68272) -- "Full of Ingredients"
>>> Copyright (C) 2015 The R Foundation for Statistical Computing
>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>> 
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>> 
>>> Natural language support but running in an English locale
>>> 
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>> 
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R.
>>> 
>>>> Sys.setlocale(locale='en_US.UTF-8')
>>> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_CA.UTF-8"
>>>> "320" > "300"
>>> [1] NA
>>>> "320" > "300"
>>> [1] TRUE
>>> 
>>> I don't see it in R-devel on Windows.
>>> 
>>> Duncan Murdoch
>>> 
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>> 
>> -- 
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
>> 
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] Bug in loadNamespace?
peter dalgaard