Repository navigation
Closed
Labels
OS-unsupportedtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
@kulikjak reports seeing the following test failure on Solaris following #142371:
======================================================================
ERROR: test_script_target_anonymous_pipe (test.test_pdb.PdbTestCase.test_script_target_anonymous_pipe)
_ScriptTarget doesn't fail on an anonymous pipe.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builds/cpython-main/Lib/test/test_pdb.py", line 3687, in test_script_target_anonymous_pipe
code_text = target.code
^^^^^^^^^^^
File "/builds/cpython-main/Lib/pdb.py", line 228, in code
with io.open_code(self._target) as fp:
~~~~~~~~~~~~^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/proc/22733/fd/4'
I am no expert here, but I tried looking into this and apparently opening anything other than regular file or directory from /proc/_pid_/root raises EACCES:
https://docs.oracle.com/cd/E88353_01/html/E37852/proc-5.html
It is however possible to open the pipe descriptor via /dev/fd and the following change fixes the issue:
--- ./cpython-main/Lib/test/test_pdb.py
+++ ./cpython-main/Lib/test/test_pdb.py
@@ -3564,8 +3564,9 @@
def _fd_dir_for_pipe_targets(self):
"""Return a directory exposing live file descriptors, if any."""
proc_fd = "/proc/self/fd"
- if os.path.isdir(proc_fd) and os.path.exists(os.path.join(proc_fd, '0')):
- return proc_fd
+ if not sys.platform.startswith("sunos"):
+ if os.path.isdir(proc_fd) and os.path.exists(os.path.join(proc_fd, '0')):
+ return proc_fd
dev_fd = "/dev/fd"
if os.path.isdir(dev_fd) and os.path.exists(os.path.join(dev_fd, '0')):Originally posted by @kulikjak in #142371 (comment)
Linked PRs
Metadata
Metadata
Assignees
Labels
OS-unsupportedtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
jaraco commentedon Dec 16, 2025
Do we know why this issue wasn't picked up by build bots?
jaraco commentedon Dec 16, 2025
Relevant code is here:
cpython/Lib/test/test_pdb.py
Lines 3564 to 3580 in a043407
jaraco commentedon Dec 16, 2025
I guess because there's no "sunos" buildbot.
jaraco commentedon Dec 16, 2025
I don't fully understand the motivations behind
_fd_dir_for_pipe_targets. I'm not sure when/procor/devis relevant. The proposed patch seems reasonable, although I'd like to see it protected by a comment (so it doesn't get optimized away) and probably be in its own stanza (so it's disentangled from the other concerns). Now that these functions are growing more complexity, perhaps they should be rewritten as separate functions so that this function body looks something like:[-]test_pdb failures on sunos following realpath fixes[/-][+]test_pdb failures on Solaris following realpath fixes[/+]aisk commentedon Dec 16, 2025
Hi, I edited the title. I think this is Solaris-related by the content. SunOS is already deprecated, so I believe the original title was just a typo. Please feel free to change it back if I’m mistaken.
jaraco commentedon Dec 16, 2025
Oh! It does fail in the Solaris buildbot (example).
I suspect the failure wasn't reported because that environment isn't at a tier included in reporting.
Copilot commentedon Dec 16, 2025
gaogaotiantian commentedon Dec 17, 2025
As far as I understand, Solaris is not our supported platform anymore. The OS itself is dying too. I don't think we have to do something on this. If there is a quick and clean fix, sure we can apply that, but I don't think it's worth it to spend too much time to investigate the OS specific behavior, or making the code super ugly just to make it work for Solaris.
pythongh-142836: Avoid /proc fd pipes on Solaris
jaraco commentedon Dec 17, 2025
I'm pleased to say, CoPilot was able to implement fully the fix, including submitting the PR, based on the discussion above.
gh-142836: Avoid /proc fd pipes on Solaris (#142853)
pythongh-142836: Avoid /proc fd pipes on Solaris (pythonGH-142853)
pythongh-142836: Avoid /proc fd pipes on Solaris (pythonGH-142853)
kulikjak commentedon Dec 17, 2025
Thank you for the fix @jaraco!
The name is a little confusing due to historical reasons, but what we know as Solaris/Illumos today is reported as
sunos5by the platform module.Indeed. The Solaris buildbot is not being reported, one reason being that it was never green - I am working on that, and thanks to several Python developers, I was able to merge some fixes recently, but it's still not quite there yet...
[3.13] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142855)
[3.14] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142854)