Never notify about pending migrations during an update
The retired omarchy-update-user-notify.path stays loaded in sessions that started before the update removing it, and pacman writes the migrations directory mid-transaction, so it fired a critical toast for migrations that omarchy-migrate was about to apply a step later. Migration 1785095882 stops that watcher, but migrations run after pacman, so it lands 11 seconds too late to prevent the toast it exists to retire. Check the lock omarchy-update holds for its whole pipeline instead of trusting that no trigger exists. That covers the stale watcher and anything added later: during an update every pending migration is by definition already being applied. The check repeats after waiting for the notification server, which is long enough for an update to start underneath it. Only this user's runtime directory is read, never the /tmp path the updater falls back to without XDG_RUNTIME_DIR. A shared lock file belongs to whoever created it first, so honouring it would let one user silence another user's notification; a redundant toast is the better failure. The sleep inhibitor now starts with the lock descriptor closed. It outlives the step that starts it, so an update killed before restore_update_inhibitors left it holding the flock indefinitely. That already blocked later updates, and now that the notifier reads the same lock it would have silenced migration notices at every login. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
4d93ad588f
commit
03902f2460
@@ -101,6 +101,41 @@ grep -q "already running" "$test_tmp/perform-second.out" || fail "second omarchy
|
||||
[[ ! -f $test_tmp/perform-second-started ]] || fail "second omarchy-update-perform did not snapshot while lock was held"
|
||||
pass "omarchy-update-perform compatibility wrapper respects update lock"
|
||||
|
||||
# The sleep inhibitor deliberately outlives the step that starts it, so it must
|
||||
# not inherit the update lock. An update killed before restore_update_inhibitors
|
||||
# would otherwise leave the inhibitor holding the flock forever, blocking every
|
||||
# later update and silencing omarchy-migrate-notify, which reads the same lock.
|
||||
inhibit_pid_file="$test_tmp/inhibit-pid"
|
||||
keyring_marker="$test_tmp/keyring-started"
|
||||
write_stub omarchy-snapshot 'exit 0'
|
||||
write_stub systemd-inhibit 'echo "$$" >"$INHIBIT_PID_FILE"; exec sleep 30'
|
||||
write_stub omarchy-update-keyring 'echo started >"$TEST_MARKER"; sleep 3; exit 0'
|
||||
|
||||
OMARCHY_UPDATE_LOGGED=1 TEST_MARKER="$keyring_marker" INHIBIT_PID_FILE="$inhibit_pid_file" \
|
||||
run_with_lock_env "$ROOT/bin/omarchy-update" -y >"$test_tmp/update-inhibit.out" 2>&1 &
|
||||
inhibit_update_pid=$!
|
||||
|
||||
for _ in {1..100}; do
|
||||
[[ -s $inhibit_pid_file && -f $keyring_marker ]] && break
|
||||
sleep 0.05
|
||||
done
|
||||
[[ -s $inhibit_pid_file ]] || fail "update starts its sleep inhibitor"
|
||||
|
||||
inhibitor_pid=$(<"$inhibit_pid_file")
|
||||
kill -0 "$inhibitor_pid" 2>/dev/null || fail "sleep inhibitor is still running when its descriptors are inspected"
|
||||
|
||||
lock_target=$(readlink -f "$runtime_dir/omarchy-update.lock")
|
||||
inhibitor_holds_lock=0
|
||||
for fd in /proc/"$inhibitor_pid"/fd/*; do
|
||||
[[ -e $fd ]] || continue
|
||||
[[ $(readlink -f "$fd" 2>/dev/null) == "$lock_target" ]] && inhibitor_holds_lock=1
|
||||
done
|
||||
|
||||
wait "$inhibit_update_pid"
|
||||
|
||||
(( inhibitor_holds_lock == 0 )) || fail "update keeps the update lock out of the sleep inhibitor it leaves running"
|
||||
pass "omarchy-update keeps the update lock out of its sleep inhibitor"
|
||||
|
||||
# Update-owned Stay Awake state must be cleared before the restart helper can
|
||||
# reboot the machine, rather than relying on an EXIT trap during shutdown.
|
||||
write_stub omarchy-snapshot 'exit 0'
|
||||
|
||||
Reference in New Issue
Block a user