| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Python source code uses on several places ifdef sun or defined(sun) without the underscores, which is not standard compliant and shouldn't be used.
Defines should check for __sun instead. Reference: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_systemGH-Solaris
https://bugs.python.org/issue35550
(cherry picked from commit 6f9bc72c79c3262e5d0f2c0e96b016477399cfb1)
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
|
|
|
|
|
|
|
| |
Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER.
Project based C Preprocessor namespacing at its finest. :P
(cherry picked from commit 3015fb8ce4d25603434b9b44bb7effb98a481532)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds configure flags for msan and ubsan builds to make it easier to enable.
These also encode the detail that address sanitizer and memory sanitizer
should disable pymalloc.
Define MEMORY_SANITIZER when appropriate at build time and adds workarounds
to existing code to mark things as initialized where the sanitizer is otherwise unable to
determine that. This lets our build succeed under the memory sanitizer. not all tests
pass without sanitizer failures yet but we're in pretty good shape after this.
(cherry picked from commit 1584a0081500d35dc93ff88e5836df35faf3e3e2)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
|
|
|
|
|
|
|
|
|
|
| |
[bpo-34658](https://www.bugs.python.org/issue34658): Fix a rare interpreter unhandled exception state SystemError only
seen when using subprocess with a preexec_fn while an after_parent handler has
been registered with os.register_at_fork and the fork system call fails.
https://bugs.python.org/issue34658
(cherry picked from commit a20b6adb5a5880fd22c099961eb9f9787739cefe)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When subprocess.Popen() stdin= stdout= or stderr= handles are specified
and appear in pass_fds=, don't close the original fds after dup'ing them.
This implementation and unittest primarily came from @izbyshev (see the PR)
See also https://github.com/izbyshev/cpython/commit/b89b52f28490b69142d5c061604b3a3989cec66c
This also removes the old manual p2cread, c2pwrite, and errwrite closing logic
as inheritable flags and _close_open_fds takes care of that properly today without special treatment.
This code is within child_exec() where it is the only thread so there is no
race condition between the dup and _Py_set_inheritable_async_safe call.
(cherry picked from commit ce34410b8b67f49d8275c05d51b3ead50cf97f48)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bpo-32844: subprocess: Fix a potential misredirection of a low fd to stderr.
When redirecting, subprocess attempts to achieve the following state:
each fd to be redirected to is less than or equal to the fd
it is redirected from, which is necessary because redirection
occurs in the ascending order of destination descriptors.
It fails to do so in a couple of corner cases,
for example, if 1 is redirected to 2 and 0 is closed in the parent.
(cherry picked from commit 0e7144b064a19493a146af94175a087b3888c37b)
Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-5562)
Fix a rare but potential pre-exec child process deadlock in subprocess on POSIX systems when marking file descriptors inheritable on exec in the child process. This bug appears to have been introduced in 3.4 with the inheritable file descriptors support.
This also changes Python/fileutils.c `set_inheritable` to use the "slow" two `fcntl` syscall path instead of the "fast" single `ioctl` syscall path when asked to be async signal safe (by way of being asked not to raise exceptions). `ioctl` is not a POSIX async-signal-safe approved function.
ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
(cherry picked from commit c1e46e94de38a92f98736af9a42d89c3975a9919)
Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
|
| |
|
|
|
|
| |
Instead use keyword only arguments to os.register_at_fork for each of the scenarios.
Updates the documentation for clarity.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-16500: Allow registering at-fork handlers
* Address Serhiy's comments
* Add doc for new C API
* Add doc for new Python-facing function
* Add NEWS entry + doc nit
|
| |
|
|\ |
|
| | |
|
| | |
|
|/
|
|
| |
private functions.
|
|\ |
|
| |
| |
| |
| | |
Also fix handling of failure to release the import lock.
|
| |
| |
| |
| |
| | |
internals regarding how fds_to_pass were passed to the child. The bug
had no actual impact as subprocess.py already avoided it.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| | |
Also update _posixsubprocess to use Py_hexdigits instead of its own constant.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
See the PEP 475 for the rationale.
|
| |
| |
| |
| | |
_posixsubprocess
|
| |
| |
| |
| |
| |
| |
| | |
Don't call _Py_open() from _close_open_fds_safe() because it is call just after
fork(). It's not good to play with locks (the GIL) between fork() and exec().
Use instead _Py_open_noraise() which doesn't touch to the GIL.
|
|/
|
|
|
|
|
|
| |
* _Py_open() now raises exceptions on error. If open() fails, it raises an
OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
held
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| | |
causing test_multiprocessing_forkserver and test_multiprocessing_spawn
failures on head (3.4).
|
| |
| |
| |
| |
| | |
causing test_multiprocessing_forkserver and test_multiprocessing_spawn
failures on head (3.4).
|
|\ \
| |/
| |
| | |
descriptor 0, 1 or 2 is closed.
|
| |
| |
| |
| | |
descriptor 0, 1 or 2 is closed.
|
| |
| |
| |
| |
| | |
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
|
|\ \
| |/ |
|
| |
| |
| |
| | |
preexec_fn callback, which may open file descriptors.
|
|\ \
| |/
| |
| | |
in the subprocess module on Linux.
|
| |
| |
| |
| | |
the subprocess module on Linux.
|
|/
|
|
| |
odd rare errors coming from the subprocess module.
|
|\
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
It was exposed by 03c98d05b140 and dbbf3ccf72e8.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| |
| |
| | |
errors correctly.
Patch by Serhiy Storchaka.
|
| |
| |
| |
| |
| |
| | |
errors correctly.
Patch by Serhiy Storchaka.
|
|\ \
| |/ |
|