diff --git a/Lib/test/support/strace_helper.py b/Lib/test/support/strace_helper.py index 7fb4581b2a7..90281b47274 100644 --- a/Lib/test/support/strace_helper.py +++ b/Lib/test/support/strace_helper.py @@ -1,6 +1,7 @@ import re import sys import textwrap +import os import unittest from dataclasses import dataclass from functools import cache @@ -163,6 +164,13 @@ def requires_strace(): if sys.platform != "linux": return unittest.skip("Linux only, requires strace.") + if "LD_PRELOAD" in os.environ: + # Distribution packaging (ex. Debian `fakeroot` and Gentoo `sandbox`) + # use LD_PRELOAD to intercept system calls, which changes the overall + # set of system calls which breaks tests expecting a specific set of + # system calls). + return unittest.skip("Not supported when LD_PRELOAD is intercepting system calls.") + if support.check_sanitizer(address=True, memory=True): return unittest.skip("LeakSanitizer does not work under ptrace (strace, gdb, etc)") diff --git a/Misc/NEWS.d/next/Tests/2024-11-21-02-03-48.gh-issue-127076.a3avV1.rst b/Misc/NEWS.d/next/Tests/2024-11-21-02-03-48.gh-issue-127076.a3avV1.rst new file mode 100644 index 00000000000..7dec8bd627c --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2024-11-21-02-03-48.gh-issue-127076.a3avV1.rst @@ -0,0 +1 @@ +Disable strace based system call tests when LD_PRELOAD is set.