Install cleanup traps before the entry revocation and bound the bus probe

The protected entrypoints revoked the sudo timestamp before installing
their cleanup traps, so a signal or failure during that first sudo -k
exited without the cleanup path. Install the traps first.

The shell restart probed the notification bus name with busctl's
default 25 second timeout, so an unresponsive user bus could stall the
restart by that much per probe. Bound each probe to one second.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Afonso OliveiraandClaude Fable 5.1 committed 2026-09-17 20:33:59 +01:00
1 parent b34b117fd0
commit 43b91163f6
5 files changed
+15 -5

No files matched your search

+3 -1
View File
@@ -61,8 +61,10 @@ relock_session() {
return 1
}
# A short timeout keeps an unresponsive user bus from stalling the restart;
# busctl would otherwise wait 25 seconds per probe.
notifications_ready() {
[[ $(busctl --user call org.freedesktop.DBus /org/freedesktop/DBus \
[[ $(busctl --user --timeout=1s call org.freedesktop.DBus /org/freedesktop/DBus \
org.freedesktop.DBus NameHasOwner s org.freedesktop.Notifications 2>/dev/null) == "b true" ]]
}