From 616a2e0a68da19240aeb8c065b2d29facfb0d099 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Mon, 19 Oct 2026 15:21:59 +1100 Subject: [PATCH 1/2] tests/ui-smoke: match the versioned python in coredumpctl A bare name given to coredumpctl matches the command name, and the GUIs run from a "#!/usr/bin/python3.13" line, so systemd-coredump records them as "gmoccapy", "qtvcp" and so on, with /usr/bin/python3.13 as the executable. The "python3" match found nothing and crashdump.sh never got the core. Match the resolved path of python3 instead, which coredumpctl compares with the executable, and give the same path to gdb. Hannes Diethelm found it in #4648. --- tests/ui-smoke/_lib/crashdump.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/ui-smoke/_lib/crashdump.sh b/tests/ui-smoke/_lib/crashdump.sh index 3867213ec50..9999f26b0f6 100644 --- a/tests/ui-smoke/_lib/crashdump.sh +++ b/tests/ui-smoke/_lib/crashdump.sh @@ -43,9 +43,14 @@ crashdump_report() { [ -e "$c" ] && [ -r "$c" ] && [ "$c" -nt "$CORE_DIR" ] && { core="$c"; break; } done fi - if [ -z "$core" ] && command -v coredumpctl >/dev/null 2>&1; then - if coredumpctl list --no-legend --since "@$crashdump_arm_time" python3 2>/dev/null | grep -q .; then - coredumpctl dump python3 --output="$CORE_DIR/core.coredumpctl" >/dev/null 2>&1 || true + # coredumpctl matches a path against the executable it recorded, which + # is the versioned interpreter (/usr/bin/python3.13), not the python3 + # link or the GUI script name, so match the resolved path. + local py + py=$(readlink -f "$(command -v python3)") + if [ -z "$core" ] && [ -n "$py" ] && command -v coredumpctl >/dev/null 2>&1; then + if coredumpctl list --no-legend --since "@$crashdump_arm_time" "$py" 2>/dev/null | grep -q .; then + coredumpctl dump "$py" --output="$CORE_DIR/core.coredumpctl" >/dev/null 2>&1 || true [ -s "$CORE_DIR/core.coredumpctl" ] && core="$CORE_DIR/core.coredumpctl" fi fi @@ -57,7 +62,7 @@ crashdump_report() { -ex "bt" \ -ex "echo \n=== all threads ===\n" \ -ex "thread apply all bt" \ - "$(command -v python3)" "$core" 2>&1 | head -400 + "${py:-python3}" "$core" 2>&1 | head -400 else # No readable core. The Python faulthandler traceback in # linuxcnc.err already names the crash site; the native backtrace From c9b2331cdeb6fd90791daadf3f7ad2867127a552 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Wed, 21 Oct 2026 12:27:42 +1100 Subject: [PATCH 2/2] tests/ui-smoke: find our own core in coredumpctl systemd-coredump lists the cores of every sandbox of a parallel run, and the PID it records is the host one, so taking the newest python core since arming can give one test the core of another. Hannes Diethelm pointed this out on #4703. Tag the launcher's environment with a UUID, which systemd-coredump keeps with the core, and dump the core whose environment carries the tag. --- tests/ui-smoke/_lib/crashdump.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/ui-smoke/_lib/crashdump.sh b/tests/ui-smoke/_lib/crashdump.sh index 9999f26b0f6..d81895bac4e 100644 --- a/tests/ui-smoke/_lib/crashdump.sh +++ b/tests/ui-smoke/_lib/crashdump.sh @@ -24,6 +24,11 @@ crashdump_arm() { export CORE_DIR ulimit -c unlimited 2>/dev/null || true crashdump_arm_time=$(date +%s) + # systemd-coredump keeps the environment of the crashed process, and + # its list is shared by every sandbox of a parallel run, so a core is + # ours only when it carries this tag. + UI_SMOKE_CRASH_TAG=$(cat /proc/sys/kernel/random/uuid) + export UI_SMOKE_CRASH_TAG } crashdump_report() { @@ -45,12 +50,17 @@ crashdump_report() { fi # coredumpctl matches a path against the executable it recorded, which # is the versioned interpreter (/usr/bin/python3.13), not the python3 - # link or the GUI script name, so match the resolved path. - local py + # link or the GUI script name, so match the resolved path. The PID it + # records is the host one, so find our core by its tag and dump that. + local py pid py=$(readlink -f "$(command -v python3)") if [ -z "$core" ] && [ -n "$py" ] && command -v coredumpctl >/dev/null 2>&1; then - if coredumpctl list --no-legend --since "@$crashdump_arm_time" "$py" 2>/dev/null | grep -q .; then - coredumpctl dump "$py" --output="$CORE_DIR/core.coredumpctl" >/dev/null 2>&1 || true + pid=$(journalctl -q -a -o json --output-fields=COREDUMP_PID,COREDUMP_ENVIRON \ + --since "@$crashdump_arm_time" COREDUMP_EXE="$py" 2>/dev/null | + grep -F "UI_SMOKE_CRASH_TAG=$UI_SMOKE_CRASH_TAG" | tail -n 1 | + sed -n 's/.*"COREDUMP_PID":"\([0-9]*\)".*/\1/p') + if [ -n "$pid" ]; then + coredumpctl dump "$pid" --output="$CORE_DIR/core.coredumpctl" >/dev/null 2>&1 || true [ -s "$CORE_DIR/core.coredumpctl" ] && core="$CORE_DIR/core.coredumpctl" fi fi