@@ -24,6 +24,11 @@ crashdump_arm() {
2424 export CORE_DIR
2525 ulimit -c unlimited 2> /dev/null || true
2626 crashdump_arm_time=$( date +%s)
27+ # systemd-coredump keeps the environment of the crashed process, and
28+ # its list is shared by every sandbox of a parallel run, so a core is
29+ # ours only when it carries this tag.
30+ UI_SMOKE_CRASH_TAG=$( cat /proc/sys/kernel/random/uuid)
31+ export UI_SMOKE_CRASH_TAG
2732}
2833
2934crashdump_report () {
@@ -43,9 +48,19 @@ crashdump_report() {
4348 [ -e " $c " ] && [ -r " $c " ] && [ " $c " -nt " $CORE_DIR " ] && { core=" $c " ; break ; }
4449 done
4550 fi
46- if [ -z " $core " ] && command -v coredumpctl > /dev/null 2>&1 ; then
47- if coredumpctl list --no-legend --since " @$crashdump_arm_time " python3 2> /dev/null | grep -q . ; then
48- coredumpctl dump python3 --output=" $CORE_DIR /core.coredumpctl" > /dev/null 2>&1 || true
51+ # coredumpctl matches a path against the executable it recorded, which
52+ # is the versioned interpreter (/usr/bin/python3.13), not the python3
53+ # link or the GUI script name, so match the resolved path. The PID it
54+ # records is the host one, so find our core by its tag and dump that.
55+ local py pid
56+ py=$( readlink -f " $( command -v python3) " )
57+ if [ -z " $core " ] && [ -n " $py " ] && command -v coredumpctl > /dev/null 2>&1 ; then
58+ pid=$( journalctl -q -a -o json --output-fields=COREDUMP_PID,COREDUMP_ENVIRON \
59+ --since " @$crashdump_arm_time " COREDUMP_EXE=" $py " 2> /dev/null |
60+ grep -F " UI_SMOKE_CRASH_TAG=$UI_SMOKE_CRASH_TAG " | tail -n 1 |
61+ sed -n ' s/.*"COREDUMP_PID":"\([0-9]*\)".*/\1/p' )
62+ if [ -n " $pid " ]; then
63+ coredumpctl dump " $pid " --output=" $CORE_DIR /core.coredumpctl" > /dev/null 2>&1 || true
4964 [ -s " $CORE_DIR /core.coredumpctl" ] && core=" $CORE_DIR /core.coredumpctl"
5065 fi
5166 fi
@@ -57,7 +72,7 @@ crashdump_report() {
5772 -ex " bt" \
5873 -ex " echo \n=== all threads ===\n" \
5974 -ex " thread apply all bt" \
60- " $( command -v python3) " " $core " 2>&1 | head -400
75+ " ${py :- python3} " " $core " 2>&1 | head -400
6176 else
6277 # No readable core. The Python faulthandler traceback in
6378 # linuxcnc.err already names the crash site; the native backtrace
0 commit comments