GNU bug report logs -
#61095
possible misuse of posix_spawn API on non-linux OSes
Previous Next
Reported by: Omar Polo <op <at> omarpolo.com>
Date: Fri, 27 Jan 2023 11:53:01 UTC
Severity: normal
Tags: patch
Merged with 61079
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#61095: [3.0.9] ‘system*’ broken on GNU/Hurd
which was filed against the guile package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 61079 <at> debbugs.gnu.org.
--
61095: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61095
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi!
Omar Polo <op <at> omarpolo.com> skribis:
> On 2023/03/30 22:21:28 +0200, Josselin Poiret <dev <at> jpoiret.xyz> wrote:
>> Hi Ludo,
>>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>
>> > Coming next is an updated patch series addressing this as proposed
>> > above. Let me know what y’all think!
>> >
>> > I tested the ‘posix_spawn_file_actions_addclosefrom_np’ path by building in:
>> >
>> > guix time-machine --branch=core-updates -- shell -CP -D -f guix.scm
>>
>> I didn't test, but this LGTM! Maybe someone on OpenBSD could test this
>> patchset?
>
> % gmake check
> <snip />
> gmake[5]: Entering directory '/home/op/w/guile/test-suite/standalone'
> PASS: test-system-cmds
>
> it seems to work on OpenBSD 7.3 :)
Awesome! Pushed as 9cc85a4f52147fcdaa4c52a62bcc87bdb267d0a9.
> but note that our libc doesn't have posix_spawn_file_actions_addclosefrom_np,
> so this is using the "racy" code path.
Yeah, not great. :-/ I hope that function will be adopted by other
libcs, especially since ‘closefrom’ is already available.
> Just for curiosity, as it's outside the scope of the bug, what's the
> reason posix_spawn was used instead of a more classic fork() +
> closefrom()?
There’s a long discussion at:
https://issues.guix.gnu.org/52835
Essentially, ‘fork’ is unusable in multi-threaded context, in addition
to being inefficient.
Thanks,
Ludo’.
[Message part 3 (message/rfc822, inline)]
This test fails on GNU/Hurd:
--8<---------------cut here---------------start------------->8---
checking for library containing posix_spawn... none required
checking whether posix_spawn is declared... yes
checking for posix_spawn... yes
checking whether posix_spawn is declared... (cached) yes
checking whether posix_spawn works... yes
checking whether posix_spawn rejects scripts without shebang... yes
checking whether posix_spawnp rejects scripts without shebang... yes
checking whether posix_spawnattr_setschedpolicy is supported... yes
checking whether posix_spawnattr_setschedparam is supported... yes
checking for mbstate_t... yes
checking for ssize_t... yes
checking for sched.h... yes
checking for struct sched_param... yes
checking whether <sys/select.h> is self-contained... yes
checking whether setenv is declared... yes
checking for search.h... yes
checking for tsearch... yes
checking for sigset_t... yes
checking for uid_t in sys/types.h... yes
checking for volatile sig_atomic_t... yes
checking for sighandler_t... yes
checking for posix_spawnattr_t... yes
checking for posix_spawn_file_actions_t... yes
[…]
make[5]: Entering directory '/tmp/guix-build-guile-3.0.9rc1.drv-0/guile-3.0.9rc1/test-suite/standalone'
In execvp of guile: Bad file descriptor
test-system-cmds: system* exit status was 127 rather than 42
FAIL: test-system-cmds
--8<---------------cut here---------------end--------------->8---
This looks like a bug in the new ‘posix_spawn’-based ‘system*’, or (more
likely) in the ‘posix_spawn’ implementation for the Hurd in glibc.
Ludo’.
This bug report was last modified 2 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.