From db05878acac33c424a73ce8472b5508c11060f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCttler?= Date: Tue, 28 Apr 2026 12:42:34 +0200 Subject: [PATCH] fix: reap orphan Xvfb before integration-ui run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xvfb-run --auto-servernum picks a fresh display number, but if a previous session left an orphan Xvfb process (e.g. killed mid-flight), the stale /tmp/.X11-unix/X socket and X-lock still belong to that orphan, and xvfb-run's cleanup at the end fails with "kill: No such process" — flipping the script's exit status to non-zero even when the integration test itself passed. Reap orphan Xvfb processes (pgrep -u $USER -x Xvfb) and remove their display sockets and lock files before invoking xvfb-run. Co-Authored-By: Claude Opus 4.7 (1M context) --- stalwart-dev/integration_ui_test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stalwart-dev/integration_ui_test.sh b/stalwart-dev/integration_ui_test.sh index a90d545..9d0209b 100755 --- a/stalwart-dev/integration_ui_test.sh +++ b/stalwart-dev/integration_ui_test.sh @@ -41,6 +41,20 @@ command -v xvfb-run >/dev/null || { exit 1 } +# Reap orphan Xvfb processes from previous sessions that were killed mid-flight. +# Without this, xvfb-run's wrapper may pick a fresh display via --auto-servernum +# but the leftover Xvfb's stale /tmp/.X11-unix/X socket and lock file confuse +# its cleanup, producing "kill: No such process" on exit and a non-zero status +# even when the test itself passed. +for _xvfb_pid in $(pgrep -u "$USER" -x Xvfb 2>/dev/null); do + _xvfb_display=$(tr '\0' ' ' < "/proc/${_xvfb_pid}/cmdline" 2>/dev/null \ + | grep -oE ':[0-9]+' | head -1) + kill "$_xvfb_pid" 2>/dev/null || true + [ -n "$_xvfb_display" ] && { + rm -f "/tmp/.X11-unix/X${_xvfb_display#:}" "/tmp/.X${_xvfb_display#:}-lock" 2>/dev/null || true + } +done + ts "script start" # Pre-seed spam-filter version so Stalwart does not fetch it on first boot.