[Rd] .conflicts.OK no longer working regardless of export(.conflicts.OK) due to "stoplist"

From: Henrik Bengtsson <hb_at_biostat.ucsf.edu>
Date: Thu, 08 Mar 2012 21:09:20 -0800


in (at least) R v2.14.2 and R v2.15.0 alpha, '.conflicts.OK' is not exported and hence to seen by library().

In R-devel thread '[Rd] Suggestion: Not having to export .conflicts.OK in name spaces' on Mar 17-22, 2010
[https://stat.ethz.ch/pipermail/r-devel/2010-March/057017.html] it was
discussed that one had to export '.conflicts.OK' in the namespace, otherwise it would not be found in the internal conflict test of library(), cf. print(base::library):

if(warn.conflicts &&

                       !exists(".conflicts.OK", envir = env, inherits = FALSE))
                        checkConflicts(package, pkgname, pkgpath,
                                       nogenerics, ns)

By replacing envir=env with envir=ns, it will be found. Here is what I get if I use debug(library):

Browse[2]> exists(".conflicts.OK", envir=env, inherits=FALSE)

Browse[2]> exists(".conflicts.OK", envir=ns, inherits=FALSE)
[1] TRUE
This was never implemented, but export(.conflicts.OK) do the job. So far so good, but in rev 56711 (Aug 12, 2011) the following piece of code was added to loadNamespace() [src/library/base/R/library.R], which drops '.conflicts.OK' regardless:

        ## process exports, seal, and clear on.exit action
        exports <- nsInfo$exports

        for (p in nsInfo$exportPatterns)
            exports <- c(ls(env, pattern = p, all.names = TRUE), exports)
        ## certain things should never be exported.
        if (length(exports)) {
            stoplist <- c(".__NAMESPACE__.", ".__S3MethodsTable__.",
                          ".packageName", ".First.lib", ".onLoad",
                          ".onAttach", ".conflicts.OK", ".noGenerics")
            exports <- exports[! exports %in% stoplist]

To confirm this is the problem one can load the package with debug(loadNamespace), step through the function and after the above "stoplist" filtering append '.conflicts.OK', e.g. exports <- c(exports, ".conflicts.OK"), and '.conflicts.OK' is yet again visible to library().

Thus, I propose to do the above 'envir=env' to 'envir=ns' update in library() to fix this.


> sessionInfo()
R version 2.14.2 Patched (2012-02-29 r58590) Platform: x86_64-pc-mingw32/x64 (64-bit)

> sessionInfo()
R version 2.15.0 alpha (2012-03-07 r58630) Platform: x86_64-pc-mingw32/x64 (64-bit)

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 09 Mar 2012 - 05:27:35 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 Mar 2012 - 12:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive