[issue43069] Python fails to read a script whose path is `/dev/fd/X`

Ronald Oussoren report at bugs.python.org
Sat Jan 30 05:09:55 EST 2021


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

I can reproduce the issue on macOS 11.1. 

As you write:
- running /dev/fd/X as a script fails silently if it refers to an smallish file
- reading /dev/fd/X referring to the same smallish files works fine (the ``open('/dev/fd/9').read()`` scenario. 

If I read the code in Modules/main.c correctly the main difference between the two scenario's is that the first scenario using the C stdio library to read the file (in pymain_run_file_obj), and the latter uses the normal Python io stack.

Reading /dev/fd/9 works fine when using either stdio or open/read in C code. 

I have not yet tried to untangle the layers of C code from pymain_run_file_obj to actually reading the script, there might be something there that sheds light on what's going on here.

I'm not yet willing to claim this is an OS bug as I've failed to reproduce this outside of Python.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43069>
_______________________________________


More information about the Python-bugs-list mailing list