Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-142836: Avoid /proc fd pipes on Solaris (GH-142853)
(cherry picked from commit c35b812)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
jaraco authored and miss-islington committed Dec 17, 2025
commit ec5c71fe0dca7b660797f924d4fe3826f7532f36
13 changes: 12 additions & 1 deletion Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3072,10 +3072,22 @@ def _assert_find_function(self, file_content, func_name, expected):

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"):
Expand All @@ -3085,7 +3097,6 @@ def _fd_dir_for_pipe_targets(self):
except FileNotFoundError:
return None
return dev_fd

return None

def test_find_function_empty_file(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accommodated Solaris in ``test_pdb.test_script_target_anonymous_pipe``.
Loading