bug#61095: [PATCH 1/3] 'spawn' closes only open file descriptors on non-GNU/Linux systems.

2023-03-29 Thread Ludovic Courtès
Fixes . Reported by Omar Polo . * libguile/posix.c (close_inherited_fds_slow): On systems other than GNU/Linux, call 'addclose' only when 'fcntl' succeeds on MAX_FD. --- libguile/posix.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --

bug#61095: [PATCH 3/3] Use 'posix_spawn_file_actions_addclosefrom_np' where available.

2023-03-29 Thread Ludovic Courtès
* configure.ac: Check for 'posix_spawn_file_actions_addclosefrom_np'. * libguile/posix.c (HAVE_ADDCLOSEFROM): New macro. (close_inherited_fds): Wrap in #ifdef HAVE_ADDCLOSEFROM. (do_spawn) [HAVE_ADDCLOSEFROM]: Use 'posix_spawn_file_actions_addclosefrom_np'. --- configure.ac | 4 +++- libguile

bug#61095: [PATCH 2/3] Remove racy optimized file descriptor closing loop in 'spawn'.

2023-03-29 Thread Ludovic Courtès
This reverts 9332b632407894c2e1951cce1bc678f19e1fa8e4, thereby reinstating the performance issue in . This optimization was subject to race conditions in multi-threaded code: new file descriptors could pop up at any time and thus leak in the child. * libguile/posix.c (

bug#61095: possible misuse of posix_spawn API on non-linux OSes

2023-03-29 Thread Ludovic Courtès
Hi! Josselin Poiret skribis: > Ludovic Courtès writes: > >> - posix_spawn_file_actions_addclose (actions, fd); >> + /* Adding invalid file descriptors to an 'addclose' action leads >> + to 'posix_spawn' failures on some operating systems: >> +