Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check DLL MD5 #3088

Merged
merged 1 commit into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#### NOTES

1. When data.table first loads it now checks the DLL's MD5. This is to detect installation issues on Windows when you upgrade and i) the DLL is in use by another R session and ii) the CRAN source version > CRAN binary binary which happens just after a new release (R prompts users to install from source until the CRAN binary is available). This situation can lead to a state where the package's new R code calls old C code in the old DLL, [R#17478](https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478), [#3056](https://github.com/Rdatatable/data.table/issues/3056). This broken state can persist until, hopefully, you experiences a strange error caused by the mismatch in versions. Otherwise, wrong results may occur silently. This situation applies to any R package with compiled code (not just data.table), is Windows-only and is long-standing. It has only recently been understood as it typically only occurs during the few days after each new release until binaries are available on CRAN. Thanks to Gabor Csardi for the suggestion to use `tools::checkMD5sums()`.


### Changes in v1.11.8

Expand Down
6 changes: 6 additions & 0 deletions R/onLoad.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

.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 (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
# binary builds that CRAN produces.
stop("This data.table installation appears to be faulty. Please close all R sessions and reinstall data.table.")
# https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478
}

"Please read FAQ 2.23 (vignette('datatable-faq')) which explains in detail why data.table adds one for loop to the start of base::cbind.data.frame and base::rbind.data.frame. If there is a better solution we will gladly change it."
# Commented as a character string so this message is retained and seen by anyone who types data.table:::.onLoad
Expand Down