From 14f8a795bc7ebe6cfa483168797df6417f20fe3d Mon Sep 17 00:00:00 2001 From: mattdowle Date: Mon, 14 Jan 2019 16:52:42 -0800 Subject: [PATCH 1/2] use is.loaded in dllVersion check --- NEWS.md | 2 ++ R/onLoad.R | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index ae1f40042a..2ce6b6413e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ #### NOTES +1. When upgrading to 1.12.0 some Windows users might have seen `CdllVersion not found` in some circumstances. We found a way to catch that so the [helpful message](https://twitter.com/MattDowle/status/1084528873549705217) now occurs for those upgrading from versions prior to 1.12.0 too, as well as those upgrading from 1.12.0 to a later version. See item 1 in notes section of 1.12.0 below for more background. + ### Changes in v1.12.0 (13 Jan 2019) diff --git a/R/onLoad.R b/R/onLoad.R index 98b6e1799b..eb8ecb984b 100644 --- a/R/onLoad.R +++ b/R/onLoad.R @@ -3,10 +3,11 @@ .onLoad <- function(libname, pkgname) { # Runs when loaded but not attached to search() path; e.g., when a package just Imports (not Depends on) data.table if (!exists("test.data.table", .GlobalEnv, inherits=FALSE) && # check when installed package is loaded but skip when developing the package with cc() - (dllV<-.Call(CdllVersion)) != (RV<-packageVersion("data.table"))) { + (dllV<-if(is.loaded("CdllVersion",PACKAGE="datatable")).Call(CdllVersion)else"before 1.12.0") != (RV<-packageVersion("data.table"))) { + # ^^ not dot as this is the name of the dll file, #3282 dll = if (.Platform$OS.type=="windows") "dll" else "so" # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478 - stop("The datatable.",dll," version (",dllV,") does not match the data.table package's version (",RV,"). Please close all R sessions to release the ",toupper(dll)," and reinstall data.table in a fresh R session. The general issue that R's package installer can leave a package in a state that is apparently functional but with new R code calling old C code silently has been filed here: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478. Please comment there if this happens to you. This misatch between R and C code can happen with any package, not just data.table. It is just that data.table has added this check.") + stop("The datatable.",dll," version (",dllV,") does not match the package (",RV,"). Please close all R sessions to release the old ",toupper(dll)," and reinstall data.table in a fresh R session. The root cause is that R's package installer can in some unconfirmed circumstances leave a package in a state that is apparently functional but where new R code is calling old C code silently: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478. We think this state only arises in the few days after an update on CRAN before Windows binaries are available: 'There is a binary version available but the source version is later. Do you want to install from source? y/n:'. However there is some debate on this. Once a package is in this mismatch state it may produce wrong results silently until you next upgrade the package. Please help by adding precise circumstances to 17478 to move the status to confirmed. This mismatch between R and C code can happen with any package not just data.table. It is just that data.table has added this check.") } if (identical(tools::checkMD5sums("data.table"), FALSE)) { # checkMD5sums outputs messages using cat() and returns NA when MD5 file is not available. The MD5 file is included in the From 192dbf8a3baf49071bf5df5895d2a441cd26d99e Mon Sep 17 00:00:00 2001 From: mattdowle Date: Mon, 14 Jan 2019 17:02:15 -0800 Subject: [PATCH 2/2] message was over 1000 character limit; shortened --- R/onLoad.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/onLoad.R b/R/onLoad.R index eb8ecb984b..d0d397d6c8 100644 --- a/R/onLoad.R +++ b/R/onLoad.R @@ -7,7 +7,7 @@ # ^^ not dot as this is the name of the dll file, #3282 dll = if (.Platform$OS.type=="windows") "dll" else "so" # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478 - stop("The datatable.",dll," version (",dllV,") does not match the package (",RV,"). Please close all R sessions to release the old ",toupper(dll)," and reinstall data.table in a fresh R session. The root cause is that R's package installer can in some unconfirmed circumstances leave a package in a state that is apparently functional but where new R code is calling old C code silently: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478. We think this state only arises in the few days after an update on CRAN before Windows binaries are available: 'There is a binary version available but the source version is later. Do you want to install from source? y/n:'. However there is some debate on this. Once a package is in this mismatch state it may produce wrong results silently until you next upgrade the package. Please help by adding precise circumstances to 17478 to move the status to confirmed. This mismatch between R and C code can happen with any package not just data.table. It is just that data.table has added this check.") + stop("The datatable.",dll," version (",dllV,") does not match the package (",RV,"). Please close all R sessions to release the old ",toupper(dll)," and reinstall data.table in a fresh R session. The root cause is that R's package installer can in some unconfirmed circumstances leave a package in a state that is apparently functional but where new R code is calling old C code silently: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478. Once a package is in this mismatch state it may produce wrong results silently until you next upgrade the package. Please help by adding precise circumstances to 17478 to move the status to confirmed. This mismatch between R and C code can happen with any package not just data.table. It is just that data.table has added this check.") } if (identical(tools::checkMD5sums("data.table"), FALSE)) { # checkMD5sums outputs messages using cat() and returns NA when MD5 file is not available. The MD5 file is included in the