Commit Graph

62 Commits

Author SHA1 Message Date
Gregory P. Smith f9681776c9 Fix computation of max_fd on OpenBSD. Issue #23852. 2015-04-25 23:43:34 -07:00
Victor Stinner e7c749238e Issue #23851: close() must not be retried when it fails with EINTR
See the PEP 475 for the rationale.
2015-04-02 16:24:46 +02:00
Victor Stinner 8f437aac06 Issue #22290: Fix error handling in the _posixsubprocess module.
* Don't call the garbage collector with an exception set: it causes an
  assertion to fail in debug mode.
* Enhance also error handling if allocating an array for the executable list
  failed.
* Add an unit test for 4 different errors in the _posixsubprocess module.
2014-10-05 17:25:19 +02:00
Gregory P. Smith a26987a0a5 Fix the comment to not refer to the removed end_fd parameter. 2014-06-01 13:46:36 -07:00
Gregory P. Smith d4dcb70287 Don't restrict ourselves to a "max" fd when closing fds before exec()
when we have a way to get an actual list of all open fds from the OS.

Fixes issue #21618: The subprocess module would ignore fds that were
inherited by the calling process and already higher than POSIX resource
limits would otherwise allow.  On systems with a functioning /proc/self/fd
or /dev/fd interface the max is now ignored and all fds are closed.
2014-06-01 13:18:28 -07:00
Gregory P. Smith efeb9da4ae Add conditional code for android's lack of definition of SYS_getdent64.
Fixes issue20307.  No Misc/NEWS entry because frankly this is an
esoteric platform for anyone to be figuring out how to cross compile
CPython for.
2014-04-14 13:31:21 -07:00
Gregory P. Smith 54532c9742 Undo supposed fix for Issue #15798 until I understand why this is
causing test_multiprocessing_forkserver and test_multiprocessing_spawn
failures on head (3.4).
2013-12-01 00:13:35 -08:00
Gregory P. Smith 361e30c17a Undo supposed fix for Issue #15798 until I understand why this is
causing test_multiprocessing_forkserver and test_multiprocessing_spawn
failures on head (3.4).
2013-12-01 00:12:24 -08:00
Gregory P. Smith 1c27e3c7fb Fixes Issue #15798 - subprocess.Popen() no longer fails if file
descriptor 0, 1 or 2 is closed.
2013-11-30 19:04:00 -08:00
Gregory P. Smith 1eda9e7c30 Fixes Issue #15798 - subprocess.Popen() no longer fails if file
descriptor 0, 1 or 2 is closed.
2013-11-30 19:02:57 -08:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Charles-François Natali a439b32cf0 Merge. 2013-08-25 18:28:44 +02:00
Charles-François Natali 249cdc39fc Issue #18763: subprocess: The file descriptors are now closed after calling the
preexec_fn callback, which may open file descriptors.
2013-08-25 18:24:45 +02:00
Gregory P. Smith b394c1dac8 Fixes Issue #16962: Use getdents64 instead of the obsolete getdents syscall
in the subprocess module on Linux.
2013-03-03 10:53:27 -08:00
Gregory P. Smith 255bf5b9ec Issue #16962: Use getdents64 instead of the obsolete getdents syscall in
the subprocess module on Linux.
2013-03-03 10:45:05 -08:00
Gregory P. Smith 8d07c264e4 Raise our own SubprocessError rather than a RuntimeError in when dealing with
odd rare errors coming from the subprocess module.
2012-11-10 23:53:47 -08:00
Gregory P. Smith a10ddb8a55 Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.
2012-10-10 03:44:47 -07:00
Gregory P. Smith 5591b02a4c Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.

It now keeps track of if the child got as far as preexec and reports it if
not back to the parent via a special "noexec" error message value in
the error pipe so that the cwd can be blamed for a failed chdir
instead of the exec of the executable being blamed instead.

The executable is also always reported accurately when exec fails.

Unittests enhanced to cover these cases.
2012-10-10 03:34:47 -07:00
Ross Lagerwall a4b070102a Merge with 3.2 2012-08-24 13:32:14 +02:00
Ross Lagerwall f2b34b8b96 Issue 15777: Fix a refleak in _posixsubprocess.
It was exposed by 03c98d05b140 and dbbf3ccf72e8.
2012-08-24 13:25:59 +02:00
Stefan Krah c0c03be53e Merge 3.2. 2012-08-20 14:42:59 +02:00
Stefan Krah db579d7b25 Issue #15738: Fix a missing NULL check in subprocess_fork_exec(). 2012-08-20 14:36:47 +02:00
Antoine Pitrou 721738fbee Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou 6f430e4963 Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Gregory P. Smith 902274e948 Fixes issue #15000: support the odd x32 abi on posixsubprocess's system call. 2012-06-05 13:30:24 -07:00
Gregory P. Smith 58f07a9d6d Fixes issue #15000: support the odd x32 abi on posixsubprocess's system call. 2012-06-05 13:26:39 -07:00
Ross Lagerwall 71faefc37e Issue #14359: Only use O_CLOEXEC in _posixmodule.c if it is defined.
Based on patch from Hervé Coatanhay.
2012-03-19 06:08:43 +02:00
Ross Lagerwall 5802fdf31f Issue 14359: Only use O_CLOEXEC in _posixmodule.c if it is defined.
Based on patch from Hervé Coatanhay.
2012-03-18 15:55:10 +02:00
Ross Lagerwall 7f4fdb266a Use ANSI C prototype instead of K&R style. 2012-03-07 20:06:33 +02:00
Benjamin Peterson 3ef2f8c296 merge 3.2 2012-01-22 20:04:58 -05:00
Benjamin Peterson 91eef984fd fix declaration style 2012-01-22 20:04:46 -05:00
Gregory P. Smith 08c1278ab8 Fix FreeBSD, NetBSD and OpenBSD behavior of the issue #8052 fix. 2012-01-21 21:06:22 -08:00
Gregory P. Smith 4842efcf97 Fix FreeBSD, NetBSD and OpenBSD behavior of the issue #8052 fix. 2012-01-21 21:01:24 -08:00
Gregory P. Smith d45382db0b bugfix for *BSD platforms. (oops messed up #define) 2012-01-21 15:20:37 -08:00
Gregory P. Smith 61f0da8c02 bugfix for issue 8052 fixes on *BSD platforms. 2012-01-21 15:20:08 -08:00
Gregory P. Smith e9b7cab1da Another issue #8052 bugfix (related to previous commit).
"oops" while rearranging the #defines.
2012-01-21 15:19:11 -08:00
Gregory P. Smith e3f7848bc5 Bugfix for issue #8052 fix on *BSD variants.
Many lack readdir64, use readdir.  Only use readdir64 on solaris where
it is required to work around a solaris bug.
2012-01-21 15:16:17 -08:00
Gregory P. Smith d635af5a61 Fixes issue #8052: The posix subprocess module's close_fds behavior was
suboptimal by closing all possible file descriptors rather than just
the open ones in the child process before exec().

It now closes only the open fds when it is possible to safely determine what
those are.
2012-01-21 14:39:29 -08:00
Gregory P. Smith 8facece99a Fixes issue #8052: The posix subprocess module's close_fds behavior was
suboptimal by closing all possible file descriptors rather than just
the open ones in the child process before exec().

It now closes only the open fds when it is possible to safely determine what
those are.
2012-01-21 14:01:08 -08:00
Gregory P. Smith e961bd4934 Avoid the compiler warning about the unused return value. 2012-01-21 12:51:30 -08:00
Gregory P. Smith 12fdca59bb Avoid the compiler warning about the unused return value. 2012-01-21 12:31:25 -08:00
Ross Lagerwall 667d75d059 Don't redefine _GNU_SOURCE if it's already defined. 2011-12-22 09:45:53 +02:00
Ross Lagerwall 031bf95d32 Issue #11006: Don't issue low level warning in subprocess when pipe2() fails. 2011-12-22 09:07:30 +02:00
Ross Lagerwall 0b77ac32b2 Merge with 3.2 for #11006. 2011-12-22 09:10:47 +02:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Ross Lagerwall 114f0e499d Issue #12607: Merge with 3.2. 2011-07-27 07:39:27 +02:00
Ross Lagerwall d98646e430 Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
given as a low fd, it gets overwritten.
2011-07-27 07:16:31 +02:00
Victor Stinner 5572ba7e15 _posixsubprocess.c: don't redefine _GNU_SOURCE if it's already defined 2011-05-26 14:10:08 +02:00
Gregory P. Smith 9c4f44f70a Fix issue #11432. if the stdin pipe is the same file descriptor as either stdout or stderr
in the _posixsubprocess C extension module it would unintentionally close the fds and raise
an error.
2011-03-15 14:56:39 -04:00