R Under development (unstable) (2026-09-17 r90559) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # charport:: consumer-wrapper semantics, exercised by charport consuming its > # own public header through R_GetCCallable. Ordinary Reader acquisition and > # acquisition protected by this test consumer must agree. The charvec builder > # variants must reproduce any reader's content as a fresh charvec, with no > # CHARSXPs between the read and build paths. > > suppressPackageStartupMessages(library(charport)) > > catn <- function(...) cat(..., "\n") > > helper <- file.path("helpers", "build_dso.R") > if (!file.exists(helper)) helper <- file.path("tests", helper) > source(helper) > helper <- file.path("helpers", "internal_calls.R") > if (!file.exists(helper)) helper <- file.path("tests", helper) > source(helper) > > catn("compiling the charport wrapper consumer (R CMD SHLIB)") compiling the charport wrapper consumer (R CMD SHLIB) > dll <- compile_test_dso("charport_consumer.cpp", label = "charport wrapper consumer") > catn("compiling the charport C consumer (R CMD SHLIB)") compiling the charport C consumer (R CMD SHLIB) > c_dll <- compile_test_dso("charport_c_header.c", label = "charport C consumer") > > stats <- charvec_stats > consumer_symbol <- function(name) getNativeSymbolInfo(name, PACKAGE = dll[["name"]]) > c_consumer_symbol <- function(name) { + getNativeSymbolInfo(name, PACKAGE = c_dll[["name"]]) + } > roundtrip <- function(x) .Call(consumer_symbol("C_consumer_reader_roundtrip"), x) > resolved_roundtrip <- function(x) { + .Call(consumer_symbol("C_consumer_resolved_reader_roundtrip"), x) + } > range_roundtrip <- function(x) { + .Call(consumer_symbol("C_consumer_reader_range_roundtrip"), x) + } > index_roundtrip <- function(x) { + .Call(consumer_symbol("C_consumer_reader_index_roundtrip"), x) + } > rebuild <- function(x, n_shards = 1L) { + .Call(consumer_symbol("C_consumer_builder_from_reader"), x, as.integer(n_shards)) + } > reserve_rebuild <- function(x, n_shards = 1L) { + .Call(consumer_symbol("C_consumer_builder_reserve"), x, as.integer(n_shards)) + } > direct_build <- function() .Call(consumer_symbol("C_consumer_builder_direct")) > growable_build <- function(x) { + .Call(consumer_symbol("C_consumer_growable_from_reader"), x) + } > growable_state <- function() .Call(consumer_symbol("C_consumer_growable_state")) > builder_errors <- function() .Call(consumer_symbol("C_consumer_builder_errors")) > c_from_views <- function(x) { + .Call(c_consumer_symbol("C_charport_c_from_views"), x) + } > c_header_probe <- function() { + .Call(c_consumer_symbol("C_charport_c_header_probe")) + } > c_abi_ok <- function() { + .Call(c_consumer_symbol("C_charport_c_abi_ok")) + } > c_reader_roundtrip <- function(x) { + .Call(c_consumer_symbol("C_charport_c_reader_roundtrip"), x) + } > read_scalar <- function(x) .Call(consumer_symbol("C_consumer_read_scalar"), x) > build_scalar <- function(x) .Call(consumer_symbol("C_consumer_build_scalar"), x) > reader_lengths <- function(x) .Call(consumer_symbol("C_consumer_reader_lengths"), x) > reader_range_lengths <- function(x) .Call(consumer_symbol("C_consumer_reader_range_lengths"), x) > reader_index_lengths <- function(x) .Call(consumer_symbol("C_consumer_reader_index_lengths"), x) > reader_byte_lengths <- function(x) { + .Call(consumer_symbol("C_consumer_reader_byte_lengths"), x) + } > reader_encodings <- function(x) .Call(consumer_symbol("C_consumer_reader_encodings"), x) > > marks_identical <- function(x, y) { + x <- as.character(x) + y <- as.character(y) + identical(x, y) && identical(Encoding(x), Encoding(y)) + } > > expect_error_matching <- function(expr, pattern) { + err <- tryCatch({expr; NULL}, error = identity) + stopifnot(inherits(err, "error")) + stopifnot(grepl(pattern, conditionMessage(err))) + } > > words_file <- "words_utf8.txt" > if (!file.exists(words_file)) words_file <- file.path("tests", "words_utf8.txt") > w_utf8 <- readLines(words_file, encoding = "UTF-8", warn = FALSE) > w_latin1 <- iconv(w_utf8, "UTF-8", "latin1") > b <- rawToChar(as.raw(0xE9)); Encoding(b) <- "bytes" > > set.seed(20260611) > > catn("charport::Reader agrees with R's character view") charport::Reader agrees with R's character view > stopifnot(isTRUE(c_abi_ok())) > inputs <- list( + character(0), + c("plain", NA, "", w_utf8[1:5], w_latin1[6:10], b), + as_charvec(c(w_utf8[1:20], NA, "", b)), + as.character(1:500) + ) > x <- as_charvec(c("m", NA)); charport_materialize(x) > inputs <- c(inputs, list(x)) > for (input in inputs) { + stopifnot(marks_identical(roundtrip(input), as.character(input))) + stopifnot(marks_identical(c_reader_roundtrip(input), as.character(input))) + stopifnot(marks_identical(range_roundtrip(input), as.character(input))) + stopifnot(marks_identical(index_roundtrip(input), rev(as.character(input)))) + expected_lengths <- nchar(as.character(input), type = "bytes", allowNA = TRUE) + stopifnot(identical(reader_lengths(input), expected_lengths)) + stopifnot(identical(reader_range_lengths(input), expected_lengths)) + stopifnot(identical(reader_index_lengths(input), rev(expected_lengths))) + stopifnot(identical(reader_byte_lengths(input), expected_lengths)) + stopifnot(length(reader_encodings(input)) == length(input)) + } > > # Explicitly protected resolution has the same values for every input class. > for (input in inputs) { + stopifnot(marks_identical(resolved_roundtrip(input), as.character(input))) + } > expect_error_matching(roundtrip(1:3), "character") > expect_error_matching(c_reader_roundtrip(1:3), "character") > > catn("scalar reads and Store::scalar build one-element views") scalar reads and Store::scalar build one-element views > x <- as_charvec(c("scalar", "tail")) > stopifnot(identical(read_scalar(x), "scalar")) > stopifnot(!stats(x)$materialized) > scalar_inputs <- c("plain", w_utf8[[1L]], w_latin1[[6L]], "", b, NA_character_) > for (value in scalar_inputs) { + out <- build_scalar(c(value, "tail")) + stopifnot(is_charvec(out), length(out) == 1L) + stopifnot(marks_identical(out, value)) + } > expect_error_matching(read_scalar(character(0)), "length at least 1") > > catn("scalar helpers release state-owning registered ALTREP classes") scalar helpers release state-owning registered ALTREP classes > release_test_count <- function() .Call(consumer_symbol("C_consumer_release_test_count")) > release_test_vector <- function() .Call(consumer_symbol("C_consumer_release_test_vector")) > unwind_probe_count <- function() .Call(consumer_symbol("C_consumer_unwind_probe_count")) > unwind_probe_reset <- function() invisible(.Call(consumer_symbol("C_consumer_unwind_probe_reset"))) > release_test_init_condition <- function(value) { + invisible(.Call( + consumer_symbol("C_consumer_release_test_init_condition"), + value + )) + } > release_test_access_status <- function(value) { + invisible(.Call( + consumer_symbol("C_consumer_release_test_access_status"), + as.integer(value) + )) + } > reader_open <- function(x) .Call(consumer_symbol("C_consumer_reader_open"), x) > reader_open_protected <- function(first, second) { + .Call( + consumer_symbol("C_consumer_reader_open_protected"), + first, + second + ) + } > reader_access_kind <- function(x, path) { + .Call( + consumer_symbol("C_consumer_reader_access_kind"), + x, + as.integer(path) + ) + } > reader_access_throw <- function(x) { + .Call(consumer_symbol("C_consumer_reader_access_throw"), x) + } > reader_access_recovers <- function(x) { + .Call(consumer_symbol("C_consumer_reader_access_recovers"), x) + } > convert_current_exception_to_status <- function(kind) { + .Call( + consumer_symbol("C_consumer_convert_current_exception_to_status"), + as.integer(kind) + ) + } > context_cpp_error <- function() .Call(consumer_symbol("C_consumer_context_cpp_error")) > reader_eval <- function(x, expression, environment = parent.frame()) { + .Call(consumer_symbol("C_consumer_reader_eval"), x, expression, environment) + } > invisible(.Call(consumer_symbol("C_consumer_register_release_test"))) > before <- release_test_count() > stopifnot(identical( + as.character(c_reader_roundtrip(release_test_vector())), + c("alpha", "beta") + )) > stopifnot(identical(release_test_count(), before + 1L)) > release_test_access_status(1L) > before <- release_test_count() > expect_error_matching( + c_reader_roundtrip(release_test_vector()), + "status 1" + ) > release_test_access_status(0L) > stopifnot(identical(release_test_count(), before + 1L)) > before <- release_test_count() > stopifnot(identical(read_scalar(release_test_vector()), "alpha")) > stopifnot(identical(release_test_count(), before + 1L)) > before <- release_test_count() > stopifnot(identical( + resolved_roundtrip(release_test_vector()), + c("alpha", "beta") + )) > stopifnot(identical(release_test_count(), before + 1L)) > > catn("consumer-owned R boundaries unwind Reader and Builder state") consumer-owned R boundaries unwind Reader and Builder state > condition <- structure( + list(message = "injected R error", code = 42L), + class = c("charport_test_error", "error", "condition") + ) > condition_env <- list2env(list(condition = condition), parent = baseenv()) > unwind_probe_reset() > before <- release_test_count() > err <- tryCatch( + reader_eval(release_test_vector(), quote(stop(condition)), condition_env), + charport_test_error = identity + ) > stopifnot(identical(err$code, 42L), identical(conditionMessage(err), "injected R error")) > stopifnot(identical(release_test_count(), before + 1L), identical(unwind_probe_count(), 1L)) > > catn("Rcpp and cpp11 adapt Reader construction and charvec conversion errors") Rcpp and cpp11 adapt Reader construction and charvec conversion errors > framework_dlls <- list() > framework_available <- c( + Rcpp = requireNamespace("Rcpp", quietly = TRUE), + cpp11 = requireNamespace("cpp11", quietly = TRUE) + ) > for (framework in names(framework_available)) { + if (!framework_available[[framework]]) { + catn(sprintf("framework factory test skipped: %s is unavailable", framework)) + next + } + + include_dir <- system.file("include", package = framework) + framework_dlls[[framework]] <- compile_test_dso( + paste0(tolower(framework), "_consumer.cpp"), + sprintf('PKG_CPPFLAGS += -I"%s"', include_dir), + paste0(framework, " Reader factory consumer") + ) + framework_symbol <- getNativeSymbolInfo( + paste0("C_", tolower(framework), "_charport_test"), + PACKAGE = framework_dlls[[framework]][["name"]] + ) + wrap_symbol <- getNativeSymbolInfo( + paste0("C_", tolower(framework), "_charport_wrap_test"), + PACKAGE = framework_dlls[[framework]][["name"]] + ) + cleanup_symbol <- getNativeSymbolInfo( + paste0("C_", tolower(framework), "_charport_cleanup_count"), + PACKAGE = framework_dlls[[framework]][["name"]] + ) + cleanup_count <- function() .Call(cleanup_symbol) + + cleanup_before <- cleanup_count() + before <- release_test_count() + out <- .Call(framework_symbol, release_test_vector()) + stopifnot(is_charvec(out), identical(as.character(out), c("alpha", "beta"))) + stopifnot(identical(release_test_count(), before + 1L)) + stopifnot(identical(cleanup_count(), cleanup_before + 1L)) + + wrapped <- .Call(wrap_symbol) + stopifnot(is_charvec(wrapped), identical(as.character(wrapped), "wrapped")) + + cleanup_before <- cleanup_count() + err <- tryCatch(.Call(framework_symbol, 1:3), error = identity) + stopifnot(grepl("character", conditionMessage(err))) + stopifnot(identical(cleanup_count(), cleanup_before + 1L)) + + release_test_init_condition(condition) + cleanup_before <- cleanup_count() + err <- tryCatch({ + .Call(framework_symbol, release_test_vector()) + NULL + }, charport_test_error = identity, finally = release_test_init_condition(NULL)) + stopifnot( + identical(err$code, 42L), + identical(conditionMessage(err), "injected R error") + ) + stopifnot(identical(cleanup_count(), cleanup_before + 1L)) + } ================================================================= ==3125615==ERROR: AddressSanitizer: odr-violation (0x7bda803fec80): [1] size=8 'fn' /data/localhost/ripley/R/packages/tests-gcc-SAN/charport.Rcheck/charport/include/charport/charvec/builder.h:137:34 in /tmp/RtmphaSmz6/rcpp_consumer_build_2fb16f1f6288a2/rcpp_consumer.so [2] size=8 'fn' /data/localhost/ripley/R/packages/tests-gcc-SAN/charport.Rcheck/charport/include/charport/charvec/builder.h:137:34 in /tmp/RtmphaSmz6/charport_consumer_build_2fb16f73d6cb2e/charport_consumer.so These globals were registered at these points: [1]: #0 0x7fda8dc1e5ef in __asan_register_globals.part.0 (/lib64/libasan.so.8+0x1e5ef) (BuildId: 61e8165ca90f7a4f06b73f064a938c76deaae079) #1 0x7fda8e4863ee in call_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:74 #2 0x7fda8e4863ee in call_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:26 #3 0x7fda8e4864cc in _dl_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:121 #4 0x7fda8e4827d6 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:215 #5 0x7fda8e48d598 in dl_open_worker /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-open.c:799 #6 0x7fda8e482728 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:241 #7 0x7fda8e48da69 in _dl_open /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-open.c:900 #8 0x7fda8c4760c3 in dlopen_doit (/lib64/libc.so.6+0x6f0c3) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #9 0x7fda8e482728 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:241 #10 0x7fda8e482878 in _dl_catch_error /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:260 #11 0x7fda8c475bb2 in _dlerror_run (/lib64/libc.so.6+0x6ebb2) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #12 0x7fda8c47617a in ___dlopen (/lib64/libc.so.6+0x6f17a) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #13 0x7fda8dc55277 in dlopen.part.0 (/lib64/libasan.so.8+0x55277) (BuildId: 61e8165ca90f7a4f06b73f064a938c76deaae079) #14 0x000000420329 in loadLibrary /data/localhost/ripley/R/svn/R-devel/src/unix/dynload.c:83 #15 0x000000420329 in AddDLL /data/localhost/ripley/R/svn/R-devel/src/main/Rdynload.c:874 #16 0x000000425af9 in do_dynload /data/localhost/ripley/R/svn/R-devel/src/main/Rdynload.c:1248 #17 0x0000008ed7eb in bcEval_loop /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8150 #18 0x0000008d86fb in bcEval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533 #19 0x000000883a0b in R_compileAndExecute /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1939 #20 0x00000089ad25 in do_for /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2786 #21 0x000000879406 in Rf_eval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1230 #22 0x000000a218f8 in Rf_ReplIteration /data/localhost/ripley/R/svn/R-devel/src/main/main.c:264 #23 0x000000a218f8 in R_ReplConsole /data/localhost/ripley/R/svn/R-devel/src/main/main.c:319 #24 0x000000a3f5ba in run_Rmainloop /data/localhost/ripley/R/svn/R-devel/src/main/main.c:1239 #25 0x000000a3f652 in Rf_mainloop /data/localhost/ripley/R/svn/R-devel/src/main/main.c:1246 #26 0x0000004120bf in main /data/localhost/ripley/R/svn/R-devel/src/main/Rmain.c:29 #27 0x7fda8c40a680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #28 0x7fda8c40a797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #29 0x000000412a84 in _start (/data/localhost/ripley/R/gcc-SAN3/bin/exec/R+0x412a84) (BuildId: 973faaf1f4961bae248128f199f3d4351c5d89a8) [2]: #0 0x7fda8dc1e5ef in __asan_register_globals.part.0 (/lib64/libasan.so.8+0x1e5ef) (BuildId: 61e8165ca90f7a4f06b73f064a938c76deaae079) #1 0x7fda8e4863ee in call_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:74 #2 0x7fda8e4863ee in call_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:26 #3 0x7fda8e4864cc in _dl_init /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-init.c:121 #4 0x7fda8e4827d6 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:215 #5 0x7fda8e48d598 in dl_open_worker /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-open.c:799 #6 0x7fda8e482728 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:241 #7 0x7fda8e48da69 in _dl_open /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-open.c:900 #8 0x7fda8c4760c3 in dlopen_doit (/lib64/libc.so.6+0x6f0c3) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #9 0x7fda8e482728 in __GI__dl_catch_exception /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:241 #10 0x7fda8e482878 in _dl_catch_error /usr/src/debug/glibc-2.43-8.fc44.x86_64/elf/dl-catch.c:260 #11 0x7fda8c475bb2 in _dlerror_run (/lib64/libc.so.6+0x6ebb2) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #12 0x7fda8c47617a in ___dlopen (/lib64/libc.so.6+0x6f17a) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #13 0x7fda8dc55277 in dlopen.part.0 (/lib64/libasan.so.8+0x55277) (BuildId: 61e8165ca90f7a4f06b73f064a938c76deaae079) #14 0x000000420329 in loadLibrary /data/localhost/ripley/R/svn/R-devel/src/unix/dynload.c:83 #15 0x000000420329 in AddDLL /data/localhost/ripley/R/svn/R-devel/src/main/Rdynload.c:874 #16 0x000000425af9 in do_dynload /data/localhost/ripley/R/svn/R-devel/src/main/Rdynload.c:1248 #17 0x0000008ed7eb in bcEval_loop /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8150 #18 0x0000008d86fb in bcEval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533 #19 0x00000087892a in Rf_eval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167 #20 0x00000088f13a in R_execClosure /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2398 #21 0x000000892e3d in applyClosure_core /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2314 #22 0x000000878fd8 in Rf_applyClosure /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2333 #23 0x000000878fd8 in Rf_eval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1278 #24 0x0000008a797e in do_set /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:3585 #25 0x000000879406 in Rf_eval /data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1230 #26 0x000000a218f8 in Rf_ReplIteration /data/localhost/ripley/R/svn/R-devel/src/main/main.c:264 #27 0x000000a218f8 in R_ReplConsole /data/localhost/ripley/R/svn/R-devel/src/main/main.c:319 #28 0x000000a3f5ba in run_Rmainloop /data/localhost/ripley/R/svn/R-devel/src/main/main.c:1239 #29 0x000000a3f652 in Rf_mainloop /data/localhost/ripley/R/svn/R-devel/src/main/main.c:1246 #30 0x0000004120bf in main /data/localhost/ripley/R/svn/R-devel/src/main/Rmain.c:29 #31 0x7fda8c40a680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #32 0x7fda8c40a797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: 5bd941be836f538fe5e10eff508f7f5dd94905a6) #33 0x000000412a84 in _start (/data/localhost/ripley/R/gcc-SAN3/bin/exec/R+0x412a84) (BuildId: 973faaf1f4961bae248128f199f3d4351c5d89a8) ==3125615==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0 SUMMARY: AddressSanitizer: odr-violation: global 'fn' at /data/localhost/ripley/R/packages/tests-gcc-SAN/charport.Rcheck/charport/include/charport/charvec/builder.h:137:34 in /tmp/RtmphaSmz6/rcpp_consumer_build_2fb16f1f6288a2/rcpp_consumer.so ==3125615==ABORTING