From 48ae985978eded62aec094c4c321a055e631c62b Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Sat, 20 Jun 2026 09:21:04 +0900 Subject: [PATCH 1/4] Gate signal handling stderr behind env var --- Fleece/Support/Backtrace+capture-posix.cc | 3 ++- Tests/SupportTests.cc | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Fleece/Support/Backtrace+capture-posix.cc b/Fleece/Support/Backtrace+capture-posix.cc index 6b2022e1..775628af 100644 --- a/Fleece/Support/Backtrace+capture-posix.cc +++ b/Fleece/Support/Backtrace+capture-posix.cc @@ -199,7 +199,8 @@ namespace signal_safe { #endif if ( fd != -1 ) write(fd, str, n ? n : strlen(str)); - write(STDERR_FILENO, str, n ? n : strlen(str)); + if (getenv("CBL_BACKTRACE_TO_STDERR") != nullptr) + write(STDERR_FILENO, str, n ? n : strlen(str)); #ifdef __clang__ # pragma clang diagnostic pop diff --git a/Tests/SupportTests.cc b/Tests/SupportTests.cc index a27f368b..8ae6d2d0 100644 --- a/Tests/SupportTests.cc +++ b/Tests/SupportTests.cc @@ -10,6 +10,7 @@ // the file licenses/APL2.txt. // +#include "TestsCommon.hh" #include "fleece/FLBase.h" #include "fleece/InstanceCounted.hh" #include "FleeceTests.hh" @@ -21,6 +22,7 @@ #include "TempArray.hh" #include "sliceIO.hh" #include "Base64.hh" +#include "c4Log.h" #include #include @@ -409,6 +411,8 @@ namespace test::backtrace { TEST_CASE("Backtrace crash", "[.BacktraceManual]") { // Since this test crashes the process intentionally, // It will fail and require manual inspection of stderr + InitTestLogging(kC4LogInfo); + setenv("CBL_BACKTRACE_TO_STDERR", "1", 1); test::backtrace::crashOnPurpose(); } From be0af60db250b0c15a3f240d08578d1c9582f5fc Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Sat, 20 Jun 2026 09:24:21 +0900 Subject: [PATCH 2/4] Remove LiteCore includes from this file --- Tests/SupportTests.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tests/SupportTests.cc b/Tests/SupportTests.cc index 8ae6d2d0..cfe8c5d6 100644 --- a/Tests/SupportTests.cc +++ b/Tests/SupportTests.cc @@ -10,7 +10,6 @@ // the file licenses/APL2.txt. // -#include "TestsCommon.hh" #include "fleece/FLBase.h" #include "fleece/InstanceCounted.hh" #include "FleeceTests.hh" @@ -22,7 +21,6 @@ #include "TempArray.hh" #include "sliceIO.hh" #include "Base64.hh" -#include "c4Log.h" #include #include @@ -411,7 +409,6 @@ namespace test::backtrace { TEST_CASE("Backtrace crash", "[.BacktraceManual]") { // Since this test crashes the process intentionally, // It will fail and require manual inspection of stderr - InitTestLogging(kC4LogInfo); setenv("CBL_BACKTRACE_TO_STDERR", "1", 1); test::backtrace::crashOnPurpose(); } From e504ccf69cf4eda977b7f92c5a85643443ca4254 Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Sat, 20 Jun 2026 09:26:47 +0900 Subject: [PATCH 3/4] Use clang for CI checks on Ubuntu --- .github/workflows/cmake.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5d53d2f3..e97e28a3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,16 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + include: + - os: ubuntu-latest + cc: clang + cxx: clang++ + - os: macOS-latest + - os: windows-latest runs-on: ${{ matrix.os }} - + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} steps: - uses: actions/checkout@v2 From 12df93d3c1a1681885e55ccf52da644945df1cf5 Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Sat, 20 Jun 2026 09:33:39 +0900 Subject: [PATCH 4/4] Windows has getenv but not setenv??? --- Tests/SupportTests.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/SupportTests.cc b/Tests/SupportTests.cc index cfe8c5d6..c1e3ccb4 100644 --- a/Tests/SupportTests.cc +++ b/Tests/SupportTests.cc @@ -409,7 +409,11 @@ namespace test::backtrace { TEST_CASE("Backtrace crash", "[.BacktraceManual]") { // Since this test crashes the process intentionally, // It will fail and require manual inspection of stderr +#ifdef _MSC_VER + SetEnvironmentVariable("CBL_BACKTRACE_TO_STDERR", "1"); +#else setenv("CBL_BACKTRACE_TO_STDERR", "1", 1); +#endif test::backtrace::crashOnPurpose(); }