[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32849: Always use fstat() to validate fds on POSIX #5773

Closed
wants to merge 2 commits into from

Conversation

Copy link
Contributor

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.
Copy link
Member

See also PR #12852.

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 closed this Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants