Skip to content

Commit d65e46f

Browse files
authored
Do not rename data.table.dll to data_table.dll (#7777)
Since R-2.15, R automatically replaces dots with understores in R_init_<DLL name>(...), so renaming is no longer necessary. This also has the side effect of working around the behaviour change from R r90101 and producing correct source tarballs on Windows again: R CMD build cleans up data.table.dll, but misses data_table.dll. * Accomodate new DLL name in atime tests
1 parent f58de7a commit d65e46f

5 files changed

Lines changed: 8 additions & 18 deletions

File tree

.ci/atime/tests.R

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ test.list <- atime::atime_test_list(
9797
pkg_find_replace <- function(glob, FIND, REPLACE) {
9898
atime::glob_find_replace(file.path(new.pkg.path, glob), FIND, REPLACE)
9999
}
100-
Package_regex <- gsub(".", "_?", old.Package, fixed = TRUE)
101-
Package_ <- gsub(".", "_", old.Package, fixed = TRUE)
102-
new.Package_ <- paste0(Package_, "_", sha)
100+
Package_regex <- gsub(".", "([_.]?)", old.Package, fixed = TRUE)
101+
Package_ <- gsub(".", "\\1", old.Package, fixed = TRUE)
102+
new.Package_ <- paste0(Package_, "\\1", sha)
103103
pkg_find_replace(
104104
"DESCRIPTION",
105105
paste0("Package:\\s+", old.Package),
@@ -112,10 +112,6 @@ test.list <- atime::atime_test_list(
112112
file.path("R", "onLoad.R"),
113113
Package_regex,
114114
new.Package_)
115-
pkg_find_replace(
116-
file.path("R", "onLoad.R"),
117-
sprintf('packageVersion\\("%s"\\)', old.Package),
118-
sprintf('packageVersion\\("%s"\\)', new.Package))
119115
pkg_find_replace(
120116
file.path("src", "init.c"),
121117
paste0("R_init_", Package_regex),

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
useDynLib("data_table", .registration=TRUE)
1+
useDynLib("data.table", .registration=TRUE)
22

33
## For S4-ization
44
importFrom(methods, "S3Part<-", slotNames)

R/onLoad.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
# Runs when loaded but not attached to search() path; e.g., when a package just Imports (not Depends on) data.table
1313
if (!exists("test.data.table", .GlobalEnv, inherits=FALSE)) {
1414
# check when installed package is loaded but skip when developing the package with cc()
15-
dllV = if (is.loaded("CdllVersion",PACKAGE="data_table")) .Call(CdllVersion) else "before 1.12.0"
15+
dllV = if (is.loaded("CdllVersion",PACKAGE="data.table")) .Call(CdllVersion) else "before 1.18.99"
1616
RV = as.character(packageVersion("data.table"))
1717
if (dllV != RV) {
18-
dll = if (.Platform$OS.type=="windows") "dll" else "so"
18+
dll = .Platform$dynlib.ext
1919
# https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17478
2020
# TODO(R>=4.0.0): Remove or adjust this message once we're sure all users are unaffected
21-
stopf("The data_table.%s version (%s) does not match the package (%s). Please close all R sessions to release the old %s and reinstall data.table in a fresh R session. Prior to R version 3.6.0 patched, R's package installer could leave a package in an apparently functional state where new R code was 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. 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.", dll, dllV, RV, toupper(dll))
21+
stopf("The data.table.%s version (%s) does not match the package (%s). Please close all R sessions to release the old %s and reinstall data.table in a fresh R session. Prior to R version 3.6.0 patched, R's package installer could leave a package in an apparently functional state where new R code was 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. 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.", dll, dllV, RV, toupper(dll))
2222
}
2323
builtPath = system.file("Meta", "package.rds", package="data.table")
2424
if (builtPath != "" && !identical(session_r_version>="4.0.0", (build_r_version <- readRDS(builtPath)$Built$R)>="4.0.0")) {
@@ -143,7 +143,7 @@ getRversion = function(...) stopf("Reminder to data.table developers: don't use
143143
# 4) Defining getRversion with a stopf() here helps prevent new switches on getRversion() being added in future. Easily circumvented but the point is to issue the message above.
144144

145145
.onUnload = function(libpath) {
146-
library.dynam.unload("data_table", libpath)
146+
library.dynam.unload("data.table", libpath)
147147
}
148148

149149
# nocov end

src/Makevars.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ PKG_LIBS = $(C_VISIBILITY) @PKG_LIBS@ @zlib_libs@
1010
all: $(SHLIB)
1111
@echo PKG_CFLAGS = $(PKG_CFLAGS)
1212
@echo PKG_LIBS = $(PKG_LIBS)
13-
if [ "$(SHLIB)" != "data_table$(SHLIB_EXT)" ]; then mv $(SHLIB) data_table$(SHLIB_EXT); fi
14-
if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id data_table$(SHLIB_EXT) data_table$(SHLIB_EXT); fi
15-

src/Makevars.win

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
22
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) -lz
3-
4-
all: $(SHLIB)
5-
mv $(SHLIB) data_table$(SHLIB_EXT)

0 commit comments

Comments
 (0)