Bug 14374 - namespace versions broken
namespace versions broken
Status: RESOLVED FIXED
Product: R
Classification: Unclassified
Component: Misc
R 2.11.1 patched
ix86 (32-bit) Windows 32-bit
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-07 02:29 UTC by Mark Bravington
Modified: 2010-09-10 00:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Bravington 2010-09-07 02:29:50 UTC
Namespace versions are broken in R 2.11.1 patched and in R 2.12 (as of 2010-08-06 r52686).

soapo> library( mgcv)
soapo> getNamespaceVersion( 'mgcv')
<NA> 
  NA 


soapo> asNamespace( 'mgcv')$.__NAMESPACE__.$spec
                                          name                                       version1 
                                        "mgcv"                              "i386-pc-mingw32" 
                                      version2                                       version3 
                                        "i386"                                      "mingw32" 
                                      version4                                       version5 
                               "i386, mingw32"                                      "Patched" 
                                      version6                                       version7 
                                           "2"                                         "11.1" 
                                      version8                                       version9 
                                        "2010"                                           "08" 
                                     version10                                      version11 
                                          "06"                                        "52686" 
                                     version12                                      version13 
                                           "R" "R version 2.11.1 Patched (2010-08-06 r52686)" 
soapo> 


Doing the self-same thing in R 2.10.1 patched (as of 2010-01-01 r50884), on the same installed package:

> getNamespaceVersion( 'mgcv')
version 
"1.6-1" 

> asNamespace( 'mgcv')$.__NAMESPACE__.$spec
   name version 
 "mgcv" "1.6-1" 

The problem seems to be in 'loadNamespace', which in R 2.11 has lost the lines below that set the object 'version':

        ##### CODE FROM R 2.10 ####
        if (file.exists(pkgInfoFP)) {
            pkgInfo <- .readRDS(pkgInfoFP)
            version <- pkgInfo$DESCRIPTION["Version"]
            dependsMethods <- "methods" %in% names(pkgInfo$Depends)
            if (dependsMethods && pkgInfo$Built$R < "2.4.0") 
                stop("package was installed prior to 2.4.0 and must be re-installed")
            if (dependsMethods) 
                loadNamespace("methods")
        }
        else {
            version <- read.dcf(file.path(pkgpath, "DESCRIPTION"), 
                fields = "Version")
            dependsMethods <- FALSE
        }

        ns <- makeNamespace(package, version = version, lib = package.lib)

In R 2.11, it's just:

       #### CODE FROM R 2.11 #####
       if (file.exists(pkgInfoFP)) {
            pkgInfo <- .readRDS(pkgInfoFP)
            if (is.null(built <- pkgInfo$Built)) 
                stop(gettextf("package '%s' has not been installed properly\n", 
                  basename(pkgpath)), call. = FALSE, domain = NA)
            R_version_built_under <- as.numeric_version(built$R)
            if (R_version_built_under < "2.10.0") 
                stop(gettextf("package '%s' was built before R 2.10.0: please re-install it", 
                  basename(pkgpath)), call. = FALSE, domain = NA)
            dependsMethods <- "methods" %in% names(pkgInfo$Depends)
            if (dependsMethods) 
                loadNamespace("methods")
        }
        ns <- makeNamespace(package, version = version, lib = package.lib)

so 'version' is never set from package info. The value of 'version' that gets passed to 'makeNamespace' somehow happens to be R's own version.

Mark Bravington

--please do not edit the information below--

R Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 11.1
 year = 2010
 month = 08
 day = 06
 svn rev = 52686
 language = R
 version.string = R version 2.11.1 Patched (2010-08-06 r52686)

Windows XP Professional x64 (build 3790) Service Pack 2

Locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

Search Path:
 .GlobalEnv, ROOT, package:grDevices, package:ad, package:chstuff, package:handy2, package:tweedie, package:statmod, package:handy, package:debug, package:mvbutils, mvb.session.info, package:tools, package:tcltk, package:stats, package:graphics, package:utils, package:methods, Autoloads, package:base
Comment 1 Duncan Murdoch 2010-09-09 20:32:10 UTC
It looks like this was an accidental change just after the R 2.11 branch was started.  I'll fix it.
Comment 2 Duncan Murdoch 2010-09-10 00:46:38 UTC
  On 09/09/2010 3:32 PM, r-bugs@r-project.org wrote:
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14374
>
> Duncan Murdoch<murdoch@stats.uwo.ca>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>               Status|NEW                         |RESOLVED
>                   CC|                            |murdoch@stats.uwo.ca
>           Resolution|                            |FIXED
>
> --- Comment #1 from Duncan Murdoch<murdoch@stats.uwo.ca>  2010-09-09 15:32:10 EDT ---
> It looks like this was an accidental change just after the R 2.11 branch was
> started.  I'll fix it.
>


Oops, that should have read "R 2.10 branch".  It happened last October.

Duncan Murdoch