Hi Omar, Apologies for the late reply. Omar Polo skribis: > I've noticed that test-system-cmds fails on OpenBSD-CURRENT while > testing the update to guile 3.0.9: > > test-system-cmds: system* exit status was 127 rather than 42 > FAIL: test-system-cmds We’re seeing the same failure on GNU/Hurd: https://issues.guix.gnu.org/61079 > Actually I can avoid the EBADF by checking that the fd is 'live' with > something like fstat: > > [[[ > > Index: libguile/posix.c > --- libguile/posix.c.orig > +++ libguile/posix.c > @@ -1325,8 +1325,12 @@ SCM_DEFINE (scm_fork, "primitive-fork", 0, 0, 0, > static void > close_inherited_fds_slow (posix_spawn_file_actions_t *actions, int max_fd) > { > - while (--max_fd > 2) > - posix_spawn_file_actions_addclose (actions, max_fd); > + struct stat sb; > + max_fd = getdtablecount(); > + while (--max_fd > 2) { > + if (fstat(max_fd, &sb) != -1) > + posix_spawn_file_actions_addclose (actions, max_fd); > + } > } I came up with the following patch: