Skip to content

Conversation

@izbyshev
Copy link
Contributor

@izbyshev izbyshev commented Feb 20, 2018

A previous approach was to usually prefer dup() for that, but
there are various circumstances under which dup() succeeds
for a descriptor unusable for I/O but fstat() fails with EBADF
causing a fatal failure in standard streams initialization.

https://bugs.python.org/issue32849

A previous approach was to usually prefer dup() for that, but there are various circumstances under which dup() succeeds for a descriptor unusable for I/O but fstat() fails with EBADF causing a fatal failure in standard streams initialization.
@vstinner
Copy link
Member

See also PR #12852.

@vstinner
Copy link
Member

My PR #12852 is more conservative: it keeps dup() on Linux. I'm not sure why exactly, but I recall that the author of the function, @pitrou, wanted to use dup() on Linux. I'm not convinced by the O_PATH case on Linux, so I merged my conservative change instead. We can move to fstat() on Linux as well if someone comes with a more concrete example against dup().

@vstinner vstinner closed this Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants