-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Pdb doesn't handle anonymous pipe symlinks #142315
Copy link
Copy link
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.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
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.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
Bug report
Bug description:
To reproduce (Bash):
❯ ./python -m pdb <(echo 'print("Hello world!")') Error: /dev/fd/63 does not existThis isn't exactly right.
/dev/fd/63was a symlink to an existing anonymous pipe, but it was checked after being processed withos.path.realpath(which made the path unusable foropenorstat-- GH-99390):cpython/Lib/pdb.py
Lines 184 to 190 in 706fdda
Technically, this is a 3.11 regression caused by https://github.com/python/cpython/pull/26992/files#r663030110.
The new behavior was preserved in the refactor of executable targets in Pdb (GH-112570). Before these two patches,
os.path.realpathwas only used in Pdb to figure out the directory to be set assys.path[0]since GH-23338. Prior to that,os.path.realpathwasn't used in Pdb at all.To fix this edge case, I think we could simply bring back the old behavior of passing the raw path to system functions and continue to use the real path elsewhere.
A dead-simple workaround is to just use regular files.
CC @jaraco @iritkatriel @gaogaotiantian
CC @ZeroIntensity (mentorship):
stdlib,3.13&3.14(unless it's a feature at this point),3.15. Not sure if I would give this OS-specific labels.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs