diff --git a/SOURCES/dbus-kill-process-with-session b/SOURCES/dbus-kill-process-with-session index dbc9fec..f891568 100644 --- a/SOURCES/dbus-kill-process-with-session +++ b/SOURCES/dbus-kill-process-with-session @@ -6,11 +6,22 @@ exec >& /dev/null -trap 'kill -TERM $1; kill -HUP $(jobs -p)' EXIT +MONITOR_READY_FILE=$(mktemp dbus-session-monitor.XXXXXX --tmpdir) + +trap 'rm -f "${MONITOR_READY_FILE}"; kill -TERM $1; kill -HUP $(jobs -p)' EXIT export GVFS_DISABLE_FUSE=1 -coproc SESSION_MONITOR (gio monitor -f "/run/systemd/sessions/${XDG_SESSION_ID}") +coproc SESSION_MONITOR (gio monitor -f "/run/systemd/sessions/${XDG_SESSION_ID}" "${MONITOR_READY_FILE}") + +# Poll until the gio monitor command is actively monitoring +until + touch "${MONITOR_READY_FILE}" + read -t 0.5 -u ${SESSION_MONITOR[0]} +do + continue +done +# Block until the session is closed while grep -q ^State=active <(loginctl show-session $XDG_SESSION_ID) do read -u ${SESSION_MONITOR[0]} diff --git a/SPECS/dbus.spec b/SPECS/dbus.spec index d409f21..9735497 100644 --- a/SPECS/dbus.spec +++ b/SPECS/dbus.spec @@ -19,7 +19,7 @@ Name: dbus Epoch: 1 Version: 1.12.8 -Release: 22%{?dist} +Release: 23%{?dist} Summary: D-BUS message bus Group: System Environment/Libraries @@ -415,6 +415,11 @@ popd %{_includedir}/* %changelog +* Tue Sep 06 2022 Ray Strode - 1:1.12.8-23 +- Address race for very short running sessions in SSH + session monitoring script. + Related: #2089362 + * Tue Aug 09 2022 Ray Strode - 1:1.12.8-22 - Use hangup signal instead of termination signal to kill sesssion monitoring script to appeach tcsh.