diff --git a/catch1-dynamic-stack.patch b/catch1-dynamic-stack.patch new file mode 100644 index 0000000..7147571 --- /dev/null +++ b/catch1-dynamic-stack.patch @@ -0,0 +1,118 @@ +diff --color -ru a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp +--- a/include/internal/catch_fatal_condition.hpp 2018-05-14 15:15:28.000000000 +0200 ++++ b/include/internal/catch_fatal_condition.hpp 2021-07-15 14:08:17.297322549 +0200 +@@ -133,10 +133,11 @@ + + struct FatalConditionHandler { + ++ static char* altStackMem; ++ static std::size_t altStackSize; + static bool isSet; + static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)]; + static stack_t oldSigStack; +- static char altStackMem[SIGSTKSZ]; + + static void handleSignal( int sig ) { + std::string name = ""; +@@ -153,10 +154,16 @@ + } + + FatalConditionHandler() { ++ assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); ++ if (altStackSize == 0) { ++ altStackSize = std::max(static_cast(SIGSTKSZ), (size_t)(32 * 1024)); ++ } ++ altStackMem = new char[altStackSize](); ++ + isSet = true; + stack_t sigStack; + sigStack.ss_sp = altStackMem; +- sigStack.ss_size = SIGSTKSZ; ++ sigStack.ss_size = altStackSize; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { 0 }; +@@ -171,6 +178,11 @@ + + ~FatalConditionHandler() { + reset(); ++ ++ delete[] altStackMem; ++ // We signal that another instance can be constructed by zeroing ++ // out the pointer. ++ altStackMem = nullptr; + } + static void reset() { + if( isSet ) { +@@ -185,10 +197,11 @@ + } + }; + ++ char* FatalConditionHandler::altStackMem = nullptr; ++ std::size_t FatalConditionHandler::altStackSize = 0; + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; +- char FatalConditionHandler::altStackMem[SIGSTKSZ] = {}; + + + } // namespace Catch +diff --color -ru a/single_include/catch.hpp b/single_include/catch.hpp +--- a/single_include/catch.hpp 2018-05-14 15:15:28.000000000 +0200 ++++ b/single_include/catch.hpp 2021-07-15 14:21:18.755941570 +0200 +@@ -6537,10 +6537,11 @@ + + struct FatalConditionHandler { + ++ static char* altStackMem; ++ static std::size_t altStackSize; + static bool isSet; + static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)]; + static stack_t oldSigStack; +- static char altStackMem[SIGSTKSZ]; + + static void handleSignal( int sig ) { + std::string name = ""; +@@ -6557,10 +6558,16 @@ + } + + FatalConditionHandler() { ++ assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); ++ if (altStackSize == 0) { ++ altStackSize = std::max(static_cast(SIGSTKSZ), (size_t)(32 * 1024)); ++ } ++ altStackMem = new char[altStackSize](); ++ + isSet = true; + stack_t sigStack; + sigStack.ss_sp = altStackMem; +- sigStack.ss_size = SIGSTKSZ; ++ sigStack.ss_size = altStackSize; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { 0 }; +@@ -6574,6 +6581,11 @@ + + ~FatalConditionHandler() { + reset(); ++ ++ delete[] altStackMem; ++ // We signal that another instance can be constructed by zeroing ++ // out the pointer. ++ altStackMem = nullptr; + } + static void reset() { + if( isSet ) { +@@ -6588,10 +6600,11 @@ + } + }; + ++ char* FatalConditionHandler::altStackMem = nullptr; ++ std::size_t FatalConditionHandler::altStackSize = 0; + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; +- char FatalConditionHandler::altStackMem[SIGSTKSZ] = {}; + + } // namespace Catch + diff --git a/catch1.spec b/catch1.spec index 7c6b56f..306659f 100644 --- a/catch1.spec +++ b/catch1.spec @@ -2,7 +2,7 @@ Name: catch1 Version: 1.12.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A modern, C++-native, header-only, framework for unit-tests, TDD and BDD License: Boost @@ -11,6 +11,8 @@ Source0: https://github.com/philsquared/Catch/archive/v%{version}/%{name} BuildRequires: cmake make gcc-c++ +Patch1: catch1-dynamic-stack.patch + %description Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, @@ -55,6 +57,10 @@ cp -pr include %{buildroot}%{_includedir}/catch %changelog +* Thu Jul 15 2021 Zoltan Fridrich - 1.12.2-9 +- Fix compilation error due to dynamic stack sizes +Resolves: rhbz#1980993 + * Thu Apr 15 2021 Mohan Boddu - 1.12.2-8 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937