Skip to content

Commit 7c2d9c9

Browse files
[3.13] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142855)
gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (cherry picked from commit c35b812) Co-authored-by: Jason R. Coombs <[email protected]>
1 parent 6990fbb commit 7c2d9c9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Lib/test/test_pdb.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3072,10 +3072,22 @@ def _assert_find_function(self, file_content, func_name, expected):
30723072

30733073
def _fd_dir_for_pipe_targets(self):
30743074
"""Return a directory exposing live file descriptors, if any."""
3075+
return self._proc_fd_dir() or self._dev_fd_dir()
3076+
3077+
def _proc_fd_dir(self):
3078+
"""Return /proc-backed fd dir when it can be used for pipes."""
3079+
# GH-142836: Opening /proc/self/fd entries for pipes raises EACCES on
3080+
# Solaris, so prefer other mechanisms there.
3081+
if sys.platform.startswith("sunos"):
3082+
return None
3083+
30753084
proc_fd = "/proc/self/fd"
30763085
if os.path.isdir(proc_fd) and os.path.exists(os.path.join(proc_fd, '0')):
30773086
return proc_fd
3087+
return None
30783088

3089+
def _dev_fd_dir(self):
3090+
"""Return /dev-backed fd dir when usable."""
30793091
dev_fd = "/dev/fd"
30803092
if os.path.isdir(dev_fd) and os.path.exists(os.path.join(dev_fd, '0')):
30813093
if sys.platform.startswith("freebsd"):
@@ -3085,7 +3097,6 @@ def _fd_dir_for_pipe_targets(self):
30853097
except FileNotFoundError:
30863098
return None
30873099
return dev_fd
3088-
30893100
return None
30903101

30913102
def test_find_function_empty_file(self):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Accommodated Solaris in ``test_pdb.test_script_target_anonymous_pipe``.

0 commit comments

Comments
 (0)