This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PEP 475: handle EINTR in fileutils.c
Type: Stage:
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: neologix, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2015-03-17 23:19 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fileutils_eintr.patch vstinner, 2015-03-18 00:53 review
Messages (9)
msg238358 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-17 23:19
fileutils.c must be modified to retry when a function fails with EINTR: see the PEP 475.

I'm working on a patch.
msg238359 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-17 23:27
New changeset 0b99d7043a99 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_open(), it now raises exceptions
https://hg.python.org/cpython/rev/0b99d7043a99
msg238366 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-18 00:46
New changeset cfe541c694f3 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
https://hg.python.org/cpython/rev/cfe541c694f3
msg238367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-18 00:53
fileutils_eintr.patch: handle EINTR for open, fopen and dup (only on Linux for dup in _Py_dup).

_Py_wfopen() and _Py_fopen() are not modified because callers are not really prepared to handle exceptions. These functions are mostly used during early steps of Python initializations. If someone is motived, you can propose a patch for these functions.

For other functions (cwd, readlink, etc.), it's not clear to me if we can get EINTR or not.
msg238381 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2015-03-18 07:03
LGTM.

Note that dup() cannot fail with EINTR, it is non-blocking: dup2() can
fail, because f the target FD is open, it has to close it, but not
dup().

See e.g. this man page from my Debian:
       EINTR  The dup2() or dup3() call was interrupted by a signal;
see signal(7).
msg238386 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-18 08:55
Charles-François Natali added the comment:
> Note that dup() cannot fail with EINTR, it is non-blocking: dup2() can
> fail, because f the target FD is open, it has to close it, but not
> dup().

Oh right, I misread the manual page. I will leave _Py_dup() unchanged.
Thanks for the review.
msg238396 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-18 10:08
All functions which can fail with EINTR now retries the function on EINTR. I close the issue.
msg238398 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-18 10:31
New changeset ed25e945cdc2 by Victor Stinner in branch 'default':
Issue #23694: Handle EINTR in _Py_open() and _Py_fopen_obj()
https://hg.python.org/cpython/rev/ed25e945cdc2
msg239538 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-30 00:21
New changeset 2e1234208bab by Victor Stinner in branch 'default':
Issue #23694: Fix usage of _Py_open() in the _posixsubprocess module
https://hg.python.org/cpython/rev/2e1234208bab
History
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67882
2015-03-30 00:21:08python-devsetmessages: + msg239538
2015-03-18 10:31:25python-devsetmessages: + msg238398
2015-03-18 10:08:40vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg238396
2015-03-18 08:55:19vstinnersetmessages: + msg238386
2015-03-18 07:03:01neologixsetmessages: + msg238381
2015-03-18 00:53:54vstinnersetnosy: + neologix
2015-03-18 00:53:46vstinnersetfiles: + fileutils_eintr.patch
keywords: + patch
messages: + msg238367
2015-03-18 00:46:24python-devsetmessages: + msg238366
2015-03-17 23:27:26python-devsetnosy: + python-dev
messages: + msg238359
2015-03-17 23:19:38vstinnercreate