-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Closed
Copy link
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
- run
python3.14 - find its pid
sudo python3.14 -m pdb -p $pid
the pdb tab will hang, the other side will display similar to:
Python 3.14.0b1 (main, May 8 2025, 08:57:13) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> Can't open debugger script /tmp/tmpmbdwo7d_:
Traceback (most recent call last):
File "/usr/lib/python3.14/_pyrepl/unix_console.py", line 422, in wait
or bool(self.pollob.poll(timeout))
PermissionError: [Errno 13] Permission denied: '/tmp/tmpmbdwo7d_'
the debugger script needs to at least be readable by the unprivileged user to be opened:
$ ls -al /tmp/tmpmbdwo7d_
-rw------- 1 root root 190 May 22 16:51 /tmp/tmpmbdwo7d_
Line 3398 in 742d5b5
| tempfile.NamedTemporaryFile("w", delete_on_close=False) |
I believe a patch similar to this fixes it:
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 78ee35f61bb..bb12d1baae8 100644
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -75,6 +75,7 @@
import code
import glob
import json
+import stat
import token
import types
import atexit
@@ -3418,6 +3419,7 @@ def attach(pid, commands=()):
)
)
connect_script.close()
+ os.chmod(connect_script.name, os.stat(connect_script.name).st_mode | stat.S_IRGRP | stat.S_IROTH)
sys.remote_exec(pid, connect_script.name)
# TODO Add a timeout? Or don't bother since the user can ^C?CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error