From 91b6c73a4f18236b35b3e88e160c4bdf3c5e543b Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 28 Apr 2026 21:36:07 +0200 Subject: [PATCH] [unittest] Use TempDir() in gtest death-test stream capture on Linux (#194142) gtest's CapturedStream on Linux hardcoded /tmp/ for its temp file without consulting the environment, causing failures in sandboxed environments where /tmp is read-only. Use TempDir() instead, which checks TEST_TMPDIR then TMPDIR and falls back to /tmp/, matching the behavior already present on Android and macOS/iOS. See also upstream PR: https://github.com/google/googletest/pull/4962 Assisted-by: Claude Code --- third-party/unittest/googletest/src/gtest-port.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/unittest/googletest/src/gtest-port.cc b/third-party/unittest/googletest/src/gtest-port.cc index 2aaf2bcc26c1..1859730478b5 100644 --- a/third-party/unittest/googletest/src/gtest-port.cc +++ b/third-party/unittest/googletest/src/gtest-port.cc @@ -1087,7 +1087,7 @@ class CapturedStream { if (name_template.back() != GTEST_PATH_SEP_[0]) name_template.push_back(GTEST_PATH_SEP_[0]); #else - name_template = "/tmp/"; + name_template = TempDir(); #endif name_template.append("gtest_captured_stream.XXXXXX");