Skip to content

Commit c4971f5

Browse files
Merge branch 'master' into fix_fwrite_length
2 parents e2e7022 + 02ced80 commit c4971f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+5473
-7172
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
^src/Makevars$
2828
^CODEOWNERS$
2929
^GOVERNANCE\.md$
30+
^Seal_of_Approval\.md$
3031

3132
^\.RData$
3233
^\.Rhistory$

.ci/linters/po/msgfmt_linter.R

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Use msgfmt to check for untranslated/fuzzy messages, and for whether
2+
# the implied .mo compiled form matches that which is already checked in
3+
msgfmt_linter <- function(po_file) {
4+
mo_tmp <- tempfile()
5+
on.exit(unlink(mo_tmp))
6+
7+
res = system2("msgfmt", c("--statistics", po_file, "-o", mo_tmp), stdout=TRUE, stderr=TRUE)
8+
if (any(grepl("untranslated message|fuzzy translation", res))) {
9+
cat(sprintf("In %s, found incomplete translations:\n%s\n", po_file, paste(res, collapse="\n")))
10+
stop("Please fix.")
11+
}
12+
13+
mo_ref = sprintf(
14+
"inst/%s/LC_MESSAGES/%sdata.table.mo",
15+
gsub("^R-|[.]po$", "", po_file),
16+
if (startsWith(basename(po_file), "R-")) "R-" else ""
17+
)
18+
19+
if (!file.exists(mo_ref)) {
20+
stop(po_file, " has not been compiled as ", mo_ref, ". Please fix.")
21+
}
22+
if (tools::md5sum(mo_ref) == tools::md5sum(mo_tmp)) return(invisible())
23+
24+
# NB: file.mtime() will probably be wrong, it will reflect the check-out time of the git repo.
25+
last_edit_time = system2("git",
26+
c("log", "-1", '--format="%ad"', "--date=format:'%Y-%m-%d %H:%M:%S'", "--", mo_ref),
27+
stdout=TRUE
28+
)
29+
cat(sprintf(
30+
".mo compilation %s of .po translation %s appears out of date! It was last updated %s\n",
31+
mo_ref, po_file, last_edit_time
32+
))
33+
34+
unmo_tmp = tempfile()
35+
unmo_ref = tempfile()
36+
on.exit(unlink(c(unmo_tmp, unmo_ref), add=TRUE))
37+
system2("msgunfmt", c(mo_tmp, "-o", unmo_tmp))
38+
system2("msgunfmt", c(mo_ref, "-o", unmo_ref))
39+
cat("Here are the observed differences after converting back to .po:\n\n")
40+
system2("diff", c(unmo_tmp, unmo_ref))
41+
stop("Please fix.")
42+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tools_check_linter = function(po_file) {
2+
res = tools::checkPoFile(po_file, strictPlural=TRUE)
3+
if (NROW(res)) {
4+
print(res)
5+
stop("Fix the above .po file issues.")
6+
}
7+
}

.ci/linters/po/utf8_linter.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
utf8_linter <- function(po_file) {
2+
if (!any(grepl("charset=UTF-8", readLines(po_file), fixed=TRUE)))
3+
stop("In ", po_file, ", please use charset=UTF-8.")
4+
}

.dev/CRAN_Release.cmd

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ R CMD build .
189189
export GITHUB_PAT="f1c.. github personal access token ..7ad"
190190
# avoids many too-many-requests in --as-cran's ping-all-URLs step (20 mins) inside the `checking CRAN incoming feasibility...` step.
191191
# Many thanks to Dirk for the tipoff that setting this env variable solves the problem, #4832.
192-
R CMD check data.table_1.15.99.tar.gz --as-cran
193-
R CMD INSTALL data.table_1.15.99.tar.gz --html
192+
R CMD check data.table_1.16.99.tar.gz --as-cran
193+
R CMD INSTALL data.table_1.16.99.tar.gz --html
194194

195195
# Test C locale doesn't break test suite (#2771)
196196
echo LC_ALL=C > ~/.Renviron
197197
R
198198
Sys.getlocale()=="C"
199199
q("no")
200-
R CMD check data.table_1.15.99.tar.gz
200+
R CMD check data.table_1.16.99.tar.gz
201201
rm ~/.Renviron
202202

203203
# Test non-English does not break test.data.table() due to translation of messages; #3039, #630
@@ -214,9 +214,9 @@ q("no")
214214

215215
# User supplied PKG_CFLAGS and PKG_LIBS passed through, #4664
216216
# Next line from https://mac.r-project.org/openmp/. Should see the arguments passed through and then fail with gcc on linux.
217-
PKG_CFLAGS='-Xclang -fopenmp' PKG_LIBS=-lomp R CMD INSTALL data.table_1.15.99.tar.gz
217+
PKG_CFLAGS='-Xclang -fopenmp' PKG_LIBS=-lomp R CMD INSTALL data.table_1.16.99.tar.gz
218218
# Next line should work on Linux, just using superfluous and duplicate but valid parameters here to see them retained and work
219-
PKG_CFLAGS='-fopenmp' PKG_LIBS=-lz R CMD INSTALL data.table_1.15.99.tar.gz
219+
PKG_CFLAGS='-fopenmp' PKG_LIBS=-lz R CMD INSTALL data.table_1.16.99.tar.gz
220220

221221
R
222222
remove.packages("xml2") # we checked the URLs; don't need to do it again (many minutes)
@@ -260,7 +260,7 @@ alias R330=~/build/R-3.3.0/bin/R
260260
### END ONE TIME BUILD
261261

262262
cd ~/GitHub/data.table
263-
R330 CMD INSTALL ./data.table_1.15.99.tar.gz
263+
R330 CMD INSTALL ./data.table_1.16.99.tar.gz
264264
R330
265265
require(data.table)
266266
test.data.table(script="*.Rraw")
@@ -272,15 +272,15 @@ test.data.table(script="*.Rraw")
272272
vi ~/.R/Makevars
273273
# Make line SHLIB_OPENMP_CFLAGS= active to remove -fopenmp
274274
R CMD build .
275-
R CMD INSTALL data.table_1.15.99.tar.gz # ensure that -fopenmp is missing and there are no warnings
275+
R CMD INSTALL data.table_1.16.99.tar.gz # ensure that -fopenmp is missing and there are no warnings
276276
R
277277
require(data.table) # observe startup message about no OpenMP detected
278278
test.data.table()
279279
q("no")
280280
vi ~/.R/Makevars
281281
# revert change above
282282
R CMD build .
283-
R CMD check data.table_1.15.99.tar.gz
283+
R CMD check data.table_1.16.99.tar.gz
284284

285285

286286
#####################################################
@@ -335,11 +335,11 @@ alias Rdevel-strict-gcc='~/build/R-devel-strict-gcc/bin/R --vanilla'
335335
alias Rdevel-strict-clang='~/build/R-devel-strict-clang/bin/R --vanilla'
336336

337337
cd ~/GitHub/data.table
338-
Rdevel-strict-[gcc|clang] CMD INSTALL data.table_1.15.99.tar.gz
338+
Rdevel-strict-[gcc|clang] CMD INSTALL data.table_1.16.99.tar.gz
339339
# Check UBSAN and ASAN flags appear in compiler output above. Rdevel was compiled with them so they should be
340340
# passed through to here. However, our configure script seems to get in the way and gets them from {R_HOME}/bin/R
341341
# So I needed to edit my ~/.R/Makevars to get CFLAGS the way I needed.
342-
Rdevel-strict-[gcc|clang] CMD check data.table_1.15.99.tar.gz
342+
Rdevel-strict-[gcc|clang] CMD check data.table_1.16.99.tar.gz
343343
# Use the (failed) output to get the list of currently needed packages and install them
344344
Rdevel-strict-[gcc|clang]
345345
isTRUE(.Machine$sizeof.longdouble==0) # check noLD is being tested
@@ -348,7 +348,7 @@ install.packages(c("bit64", "bit", "R.utils", "xts", "zoo", "yaml", "knitr", "ma
348348
Ncpus=4)
349349
# Issue #5491 showed that CRAN is running UBSAN on .Rd examples which found an error so we now run full R CMD check
350350
q("no")
351-
Rdevel-strict-[gcc|clang] CMD check data.table_1.15.99.tar.gz
351+
Rdevel-strict-[gcc|clang] CMD check data.table_1.16.99.tar.gz
352352
# UBSAN errors occur on stderr and don't affect R CMD check result. Made many failed attempts to capture them. So grep for them.
353353
find data.table.Rcheck -name "*Rout*" -exec grep -H "runtime error" {} \;
354354

@@ -385,7 +385,7 @@ cd R-devel-valgrind
385385
make
386386
cd ~/GitHub/data.table
387387
vi ~/.R/Makevars # make the -O2 -g line active, for info on source lines with any problems
388-
Rdevel-valgrind CMD INSTALL data.table_1.15.99.tar.gz
388+
Rdevel-valgrind CMD INSTALL data.table_1.16.99.tar.gz
389389
R_DONT_USE_TK=true Rdevel-valgrind -d "valgrind --tool=memcheck --leak-check=full --track-origins=yes --show-leak-kinds=definite,possible --gen-suppressions=all --suppressions=./.dev/valgrind.supp -s"
390390
# the default for --show-leak-kinds is 'definite,possible' which we're setting explicitly here as a reminder. CRAN uses the default too.
391391
# including 'reachable' (as 'all' does) generates too much output from R itself about by-design permanent blocks
@@ -423,7 +423,7 @@ cd ~/build/rchk/trunk
423423
. ../scripts/config.inc
424424
. ../scripts/cmpconfig.inc
425425
vi ~/.R/Makevars # set CFLAGS=-O0 -g so that rchk can provide source line numbers
426-
echo 'install.packages("~/GitHub/data.table/data.table_1.15.99.tar.gz",repos=NULL)' | ./bin/R --slave
426+
echo 'install.packages("~/GitHub/data.table/data.table_1.16.99.tar.gz",repos=NULL)' | ./bin/R --slave
427427
# objcopy warnings (if any) can be ignored: https://github.com/kalibera/rchk/issues/17#issuecomment-497312504
428428
. ../scripts/check_package.sh data.table
429429
cat packages/lib/data.table/libs/*check
@@ -589,7 +589,7 @@ du -k inst/tests # 0.75MB after
589589
R CMD build .
590590
export GITHUB_PAT="f1c.. github personal access token ..7ad"
591591
Rdevel -q -e "packageVersion('xml2')" # ensure installed
592-
Rdevel CMD check data.table_1.16.0.tar.gz --as-cran # use latest Rdevel as it may have extra checks
592+
Rdevel CMD check data.table_1.17.0.tar.gz --as-cran # use latest Rdevel as it may have extra checks
593593
bunzip2 inst/tests/*.Rraw.bz2 # decompress *.Rraw again so as not to commit compressed *.Rraw to git
594594

595595
#
@@ -621,10 +621,10 @@ bunzip2 inst/tests/*.Rraw.bz2 # decompress *.Rraw again so as not to commit com
621621
# 3. Add new heading in NEWS for the next dev version. Add "(submitted to CRAN on <today>)" on the released heading.
622622
# 4. Bump minor version in dllVersion() in init.c
623623
# 5. Bump 3 minor version numbers in Makefile
624-
# 6. Search and replace this .dev/CRAN_Release.cmd to update 1.15.99 to 1.16.99 inc below, 1.16.0 to 1.17.0 above, 1.15.0 to 1.16.0 below
624+
# 6. Search and replace this .dev/CRAN_Release.cmd to update 1.16.99 to 1.16.99 inc below, 1.16.0 to 1.17.0 above, 1.15.0 to 1.16.0 below
625625
# 7. Another final gd to view all diffs using meld. (I have `alias gd='git difftool &> /dev/null'` and difftool meld: http://meldmerge.org/)
626-
# 8. Push to master with this consistent commit message: "1.16.0 on CRAN. Bump to 1.16.99"
627-
# 9. Take sha from the previous step and run `git tag 1.16.0 96c..sha..d77` then `git push origin 1.16.0` (not `git push --tags` according to https://stackoverflow.com/a/5195913/403310)
626+
# 8. Push to master with this consistent commit message: "1.17.0 on CRAN. Bump to 1.17.99"
627+
# 9. Take sha from the previous step and run `git tag 1.17.0 96c..sha..d77` then `git push origin 1.16.0` (not `git push --tags` according to https://stackoverflow.com/a/5195913/403310)
628628
######
629629

630630
###### Branching policy for PATCH RELEASE

.dev/cc.R

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,35 @@ cc = function(test=FALSE, clean=FALSE, debug=FALSE, omp=!debug, path=Sys.getenv(
7070
dll = grep("data_table.so", dll, fixed=TRUE, value=TRUE)
7171
sapply(dll, dyn.unload)
7272
gc()
73+
74+
# hack for windows under mingw-like environment
75+
# PROJ_PATH must be windows like i.e.: export PROJ_PATH=$(Rscript -e 'getwd()')
76+
if (.Platform$OS.type == "windows") {
77+
system = function(command, ...) shell(shQuote(command, "sh"), shell = "sh",...)
78+
# when -std=c99, macro WIN32 is not defined (MinGW) so we define it
79+
# otherwise will fail as sys/mman.h does not exists in windows (fread.c)
80+
W32 = "-DWIN32"
81+
dt_object = "data_table"
82+
} else {
83+
W32 = ""
84+
dt_object = "data_table.so"
85+
}
7386

7487
old = getwd()
7588
on.exit(setwd(old))
7689
setwd(file.path(path,"src"))
7790
if (!quiet) cat(getwd(),"\n")
7891
if (clean) system("rm *.o *.so")
79-
OMP = if (omp) "" else "no-"
92+
OMP = if (omp) "openmp" else "no-openmp"
8093
if (debug) {
81-
ret = system(ignore.stdout=quiet, sprintf("MAKEFLAGS='-j CC=%s PKG_CFLAGS=-f%sopenmp CFLAGS=-std=c99\\ -O0\\ -ggdb\\ -pedantic' R CMD SHLIB -d -o data_table.so *.c", CC, OMP))
94+
cmd = sprintf(R"(MAKEFLAGS='-j CC=%s PKG_CFLAGS=-f% CFLAGS=-std=c99\ -O0\ -ggdb\ %s\ -pedantic' R CMD SHLIB -d -o data_table.so *.c)", CC, OMP, W32)
8295
} else {
83-
ret = system(ignore.stdout=quiet, sprintf("MAKEFLAGS='-j CC=%s CFLAGS=-f%sopenmp\\ -std=c99\\ -O3\\ -pipe\\ -Wall\\ -pedantic\\ -Wstrict-prototypes\\ -isystem\\ /usr/share/R/include\\ -fno-common' R CMD SHLIB -o data_table.so *.c", CC, OMP))
96+
cmd = sprintf(R"(MAKEFLAGS='-j CC=%s CFLAGS=-f%s\ -std=c99\ -O3\ -pipe\ -Wall\ -pedantic\ -Wstrict-prototypes\ -isystem\ /usr/share/R/include\ %s\ -fno-common' R CMD SHLIB -o data_table.so *.c)", CC, OMP, W32)
8497
# the -isystem suppresses strict-prototypes warnings from R's headers, #5477. Look at the output to see what -I is and pass the same path to -isystem.
8598
# TODO add -Wextra too?
8699
}
100+
cat(sprintf("Running command:\n%s\n", cmd))
101+
ret = system(cmd, ignore.stdout=quiet)
87102
if (ret) return()
88103
# clang -Weverything includes -pedantic and issues many more warnings than gcc
89104
# system("R CMD SHLIB -o data_table.so *.c")
@@ -93,7 +108,7 @@ cc = function(test=FALSE, clean=FALSE, debug=FALSE, omp=!debug, path=Sys.getenv(
93108
break
94109
}
95110
}
96-
dyn.load("data_table.so")
111+
dyn.load(dt_object)
97112
setwd(old)
98113
xx = getDLLRegisteredRoutines("data_table",TRUE)
99114
for (Call in xx$.Call)

.github/workflows/code-quality.yaml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,18 @@ jobs:
5656
- uses: r-lib/actions/setup-r@v2
5757
- name: Check translations
5858
run: |
59-
setwd("po")
60-
for (po_file in list.files(pattern = "[.]po$")) {
61-
res = tools::checkPoFile(po_file, strictPlural=TRUE)
62-
if (NROW(res)) { print(res); stop("Fix the above .po file issues.") }
63-
64-
if (!any(grepl("charset=UTF-8", readLines(po_file), fixed=TRUE)))
65-
stop("In ", po_file, ", please use charset=UTF-8.")
66-
67-
res = system2("msgfmt", c("--statistics", po_file, "-o", tempfile()), stdout=TRUE, stderr=TRUE)
68-
if (any(grepl("untranslated message|fuzzy translation", res))) {
69-
cat(sprintf("In %s, found incomplete translations:\n%s\n", po_file, paste(res, collapse="\n")))
70-
stop("Please fix.")
71-
}
59+
linter_env = new.env()
60+
for (f in list.files('.ci/linters/po', full.names=TRUE)) sys.source(f, linter_env)
61+
for (po_file in list.files(pattern = "[.]po$", full.names=TRUE)) {
62+
# only pay attention to files edited in the current PR, otherwise we can get
63+
# a situation like after #6424 where some untranslated messages were added
64+
# as part of non-translation maintenance, but this GHA would go red repeatedly
65+
# until a translation is added or the blank/fuzzy translations removed. We'd
66+
# rather only have the failure on one PR, then ignore these files later.
67+
diff_v_master = system2("git", c("diff", "master", po_file), stdout=TRUE)
68+
if (!length(diff_v_master)) next
69+
for (linter in ls(linter_env)) linter_env[[linter]](po_file)
7270
}
73-
cat("All translation quality checks completed successfully!\n")
7471
shell: Rscript {0}
7572
lint-md:
7673
runs-on: ubuntu-latest

.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ test-win-old:
272272
tags:
273273
- saas-macos-medium-m1
274274
before_script:
275+
- if ! command -v R &> /dev/null || ! command -v Rscript &> /dev/null; then brew install r; fi
275276
- *install-deps
276277
- cp $(ls -1t bus/build/data.table_*.tar.gz | head -n 1) .
277278
after_script:
@@ -288,7 +289,7 @@ test-mac-rel:
288289
variables:
289290
R_VERSION: "$R_REL_VERSION"
290291
script:
291-
- R CMD check $(ls -1t data.table_*.tar.gz | head -n 1)
292+
- R CMD check --no-manual $(ls -1t data.table_*.tar.gz | head -n 1)
292293
- R CMD INSTALL --build $(ls -1t data.table_*.tar.gz | head -n 1)
293294

294295
## integrate artifacts

.graphics/rdatatable.png

148 KB
Loading

0 commit comments

Comments
 (0)