Skip to content

Conversation

@ppisar
Copy link
Collaborator

@ppisar ppisar commented Jan 14, 2026

After upgrading glib from 2.86.1 to 2.87.0, tests which expect catching SIGTRAP started to fail like this:

[...]/redhat-linux-build/modulemd/component_module
TAP version 14
# random seed: R02S501b6bd02413a2980133f197dab99416
1..6
# Start of modulemd tests
# Start of v2 tests
# Start of component tests
# Start of module tests
not ok /modulemd/v2/component/module/construct - libmodulemd-FATAL-CRITICAL: modulemd_component_set_key: assertion 'name' failed
Bail out!
Aborted                    (core dumped) LD_LIBRARY_PATH=/home/test/libmodulemd-devel/redhat-linux-build/modulemd MESON_BUILD_ROOT=/home/test/libmodulemd-devel/redhat-linux-build TEST_DATA_PATH=/home/test/libmodulemd-devel/modulemd/tests/test_data UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 LC_ALL=C MESON_TEST_ITERATION=1 MESON_SOURCE_ROOT=/home/test/libmodulemd-devel MALLOC_PERTURB_=115 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 /home/test/libmodulemd-devel/redhat-linux-build/modulemd/component_module

The tests passed a NULL pointer to libmodulemd object constructors and checked that glib raised a SIGTRAP signal. The new glib fixed https://gitlab.gnome.org/GNOME/glib/-/issues/3790 and as a side effect changed how the process is terminated: If the process runs under a debugger, a breakpoint trap is invoked or SIGTRAP raised, depending on the architecture. If the process does not run under a debugger, abort() is called, which raises SIGABRT and then after returning to glib SIGABRT disposition is reset and SIGABRT raised again to finally terminate the process. That means that catching signals is pointless because the process will be terminated nevertheless.

This patch adapts the tests by using a glib-sanctioned way of checking whether a process terminated abnormally instead of depending on a way a particular glib version implements.

This patch moves the trapping subtests into standalone tests because g_test_trap_subprocess() cannot handle multiple subtests in a single test function. It also removes pointless checks for a return value of a function which has just exited the process.

The same goes for Python tests (with
G_DEBUG=fatal-warnings,fatal-criticals) which originally went as far as checking whether and which signal was raised. This patch makes the Python tests passing regardless of G_DEBUG setting.

Implementation note: Python does not support annoymous block and context managers are not compatible with fork, hence this patch moves the blocks into named callables to be exectuted in a subprocess.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2423153

@ppisar
Copy link
Collaborator Author

ppisar commented Jan 14, 2026

The new way of running tests in a subprocess does work on old glib. I will implement a fallback.

After upgrading glib from 2.86.1 to 2.87.0, tests which expect catching
SIGTRAP started to fail like this:

    [...]/redhat-linux-build/modulemd/component_module
    TAP version 14
    # random seed: R02S501b6bd02413a2980133f197dab99416
    1..6
    # Start of modulemd tests
    # Start of v2 tests
    # Start of component tests
    # Start of module tests
    not ok /modulemd/v2/component/module/construct - libmodulemd-FATAL-CRITICAL: modulemd_component_set_key: assertion 'name' failed
    Bail out!
    Aborted                    (core dumped) LD_LIBRARY_PATH=/home/test/libmodulemd-devel/redhat-linux-build/modulemd MESON_BUILD_ROOT=/home/test/libmodulemd-devel/redhat-linux-build TEST_DATA_PATH=/home/test/libmodulemd-devel/modulemd/tests/test_data UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 LC_ALL=C MESON_TEST_ITERATION=1 MESON_SOURCE_ROOT=/home/test/libmodulemd-devel MALLOC_PERTURB_=115 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 /home/test/libmodulemd-devel/redhat-linux-build/modulemd/component_module

The tests passed a NULL pointer to libmodulemd object constructors and
checked that glib raised a SIGTRAP signal. The new glib fixed
<https://gitlab.gnome.org/GNOME/glib/-/issues/3790> and as a side
effect changed how the process is terminated: If the process runs
under a debugger, a breakpoint trap is invoked or SIGTRAP raised,
depending on the architecture. If the process does not run under
a debugger, abort() is called, which raises SIGABRT and then after
returning to glib SIGABRT disposition is reset and SIGABRT raised
again to finally terminate the process. That means that catching
signals is pointless because the process will be terminated
nevertheless.

This patch adapts the tests by using a glib-sanctioned way of checking
whether a process terminated abnormally instead of depending on
a way a particular glib version implements.

This patch moves the trapping subtests into standalone tests because
g_test_trap_subprocess() cannot handle multiple subtests in a single
test function. It also removes pointless checks for a return value of
a function which has just exited the process.

The same goes for Python tests (with
G_DEBUG=fatal-warnings,fatal-criticals) which originally went as far
as checking whether and which signal was raised. This patch makes the
Python tests passing regardless of G_DEBUG setting.

Implementation note: Python does not support annoymous block and
context managers are not compatible with fork, hence this patch moves
the blocks into named callables to be exectuted in a subprocess.

Implementation note: Glib provides G_TEST_SUBPROCESS_DEFAULT constant
since 2.74. This patch adds a fallback definition instead of
hard-coding 0 literal.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2423153
@ppisar
Copy link
Collaborator Author

ppisar commented Jan 14, 2026

Now it builds everywhere. Mandriva has again (still?) broken dependencies in its packages.

@ppisar ppisar merged commit 89d4afb into fedora-modularity:main Jan 14, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant