]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142854)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 17 Dec 2025 13:20:34 +0000 (14:20 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Dec 2025 13:20:34 +0000 (08:20 -0500)
gh-142836: Avoid /proc fd pipes on Solaris (GH-142853)
(cherry picked from commit c35b812e773493f88631cd1e8be65d3a7c3b47ae)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Lib/test/test_pdb.py
Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst [new file with mode: 0644]

index e8991a6705118c12859f825a083710f0a3c70e52..16d1015cc4fca1d0734ac0d95a9bc61f4feb28f7 100644 (file)
@@ -3563,10 +3563,22 @@ class PdbTestCase(unittest.TestCase):
 
     def _fd_dir_for_pipe_targets(self):
         """Return a directory exposing live file descriptors, if any."""
+        return self._proc_fd_dir() or self._dev_fd_dir()
+
+    def _proc_fd_dir(self):
+        """Return /proc-backed fd dir when it can be used for pipes."""
+        # GH-142836: Opening /proc/self/fd entries for pipes raises EACCES on
+        # Solaris, so prefer other mechanisms there.
+        if sys.platform.startswith("sunos"):
+            return None
+
         proc_fd = "/proc/self/fd"
         if os.path.isdir(proc_fd) and os.path.exists(os.path.join(proc_fd, '0')):
             return proc_fd
+        return None
 
+    def _dev_fd_dir(self):
+        """Return /dev-backed fd dir when usable."""
         dev_fd = "/dev/fd"
         if os.path.isdir(dev_fd) and os.path.exists(os.path.join(dev_fd, '0')):
             if sys.platform.startswith("freebsd"):
@@ -3576,7 +3588,6 @@ class PdbTestCase(unittest.TestCase):
                 except FileNotFoundError:
                     return None
             return dev_fd
-
         return None
 
     def test_find_function_empty_file(self):
diff --git a/Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst b/Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst
new file mode 100644 (file)
index 0000000..dd84ce9
--- /dev/null
@@ -0,0 +1 @@
+Accommodated Solaris in ``test_pdb.test_script_target_anonymous_pipe``.