From 6fba930c381e1c2adac7ffa23156a68b714fab6a Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Thu, 24 Jun 2021 10:47:29 -0400 Subject: [PATCH] Use a constant value for the stack size Fixes #1373 --- NEWS.md | 3 +++ inst/include/testthat/vendor/catch.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index bb6a68e38..e09140479 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # testthat (development version) +* The vendored Catch code used for `use_catch()` now uses an constant value for the stack size rather than relying on SIGSTKSZ. + This fixes compatibility for recent glibc versions where SIGSTKSZ is no longer a constant. + # testthat 3.0.2 * Failing expectations now include a backtrace when they're not called directly diff --git a/inst/include/testthat/vendor/catch.h b/inst/include/testthat/vendor/catch.h index b1b4a474e..e8a10b07e 100644 --- a/inst/include/testthat/vendor/catch.h +++ b/inst/include/testthat/vendor/catch.h @@ -6492,7 +6492,7 @@ namespace Catch { static bool isSet; static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)]; static stack_t oldSigStack; - static char altStackMem[SIGSTKSZ]; + static char altStackMem[32768]; static void handleSignal( int sig ) { std::string name = ""; @@ -6512,7 +6512,7 @@ namespace Catch { isSet = true; stack_t sigStack; sigStack.ss_sp = altStackMem; - sigStack.ss_size = SIGSTKSZ; + sigStack.ss_size = 32768; sigStack.ss_flags = 0; sigaltstack(&sigStack, &oldSigStack); struct sigaction sa = { 0 }; @@ -6543,7 +6543,7 @@ namespace Catch { bool FatalConditionHandler::isSet = false; struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[SIGSTKSZ] = {}; + char FatalConditionHandler::altStackMem[32768] = {}; } // namespace Catch