alpine/musl: catching signals from a subprocess triggers GLib:ERROR:../glib/gmain.c:5569:siginfo_t_to_wait_status: code should not be reached
At some time between November 21 and November 24, umockdev's tests started to fail on Alpine, on a g_assert_not_reached()
in siginfo_t_to_wait_status
.
I wrote a small standalone reproducer to illustrate this:
#include <glib.h>
#include <glib/gstdio.h>
static void
t_glib_bug()
{
if (g_test_subprocess()) {
fprintf(stderr, "something horrible happened\n");
abort();
}
g_test_trap_subprocess(NULL, 0, 0);
g_test_trap_assert_failed();
g_test_trap_assert_stderr("something horrible happened\n");
}
int
main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
g_test_add_func("/umockdev-testbed/glib", t_glib_bug);
return g_test_run();
}
Compile/run with
gcc -g -O0 `pkg-config --cflags glib-2.0` test-glib-signal-bug.c `pkg-config --libs glib-2.0` && ./a.out
This succeeds on current Fedora 37, Debian, Ubuntu etc. and everywhere except on Alpine, so I suppose it's somehow related to running against musl libc. There it fails like this:
# Start of umockdev-testbed tests
**
GLib:ERROR:../glib/gmain.c:5569:siginfo_t_to_wait_status: code should not be reached
Bail out! GLib:ERROR:../glib/gmain.c:5569:siginfo_t_to_wait_status: code should not be reached
Aborted (core dumped)
musl-1.2.3-r4 x86_64 {musl} (MIT) [installed] glib-2.74.3-r2 x86_64 {glib} (LGPL-2.1-or-later) [installed]