-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Status
Done