You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lock: identify the machine by a stable id, so a host rename or a shared host name cannot block or break the logbook #101
Found in the sage's repo pass (T206, run R716). Size: small. Low. The rest of the state tool review was clean: no high or medium finding, no table column changed, and each new test fails on the old code.
The problem
The lock (packages/sage-core/state.mjs, gone() at about line 1218, and the waiter clean-up at about lines 1260 and 1272) decides by the host name whether a lock holder is on this machine.
After this Mac's host name changes, a sage command that crashed while it held the lock looks like a holder on another machine. The next command never clears it, and the logbook stays busy until a person removes the lock folder. Old waiter folders also stay. No row is lost; the refusal tells the user what to remove. (Before PR Keep foreign-host lock owners and waiters (T152) #90, the old code cleared such a holder when the boot times were close.)
Two machines with the same host name that share one logbook (for example through a synced folder) count as one machine. The pid and boot-time rules can then clear a live holder on the other machine, and two writers can lose rows. This is older than PR Keep foreign-host lock owners and waiters (T152) #90.
Goal
Identify the machine by a stable id as well as the host name: on macOS the hardware UUID (IOPlatformUUID), on Linux /etc/machine-id, read without running a process-list tool. Write it into the lock's owner file.
Same id: this machine, whatever the host name; the local rules apply.
Different id: another machine; never cleared, whatever the host name.
No id in an old owner file: keep today's host-name rule.
Acceptance
Tests with an injected machine id cover: a renamed host with the same id (cleared when dead), the same host name with another id (kept), and an old owner file without an id (today's rule).
npm run build, npm run check and npm test pass with fake ps, pgrep and kill first on PATH. No test reads the real process list or the real machine id.
Activity