Repository navigation
Keep a second update from wiping the running update's transcript - #17020
sundarshahi wants to merge 3 commits into
Conversation
[Low impact] The PR appears safe to merge. SummaryKeeps overlapping updates from erasing the running update's transcript.
Reviews (5) · Last reviewed commit: "Keep the PATH test off the host's update..." · Reviewed by Greptile |
449d5eb to
ffa8ae6
Compare
|
Reviewed at ffa8ae6. The bug is real and this fixes its cause. I found nothing to change. What was checked, on a disposable Omarchy worker (util-linux 2.42.4):
Second opinion: Codex (medium effort) and muse-wonder via pi (high thinking) reviewed the diff. Neither found a blocking defect. Both traced every entry path (fresh, already logged, lock inherited, One thing for the maintainer to weigh. It does not block the fix. The pin sets This touches the lines next to #17012, which moves the transcript out of |
script(1) truncates the transcript when it opens it, and the lock was only taken inside it. A second omarchy update therefore wiped the running update's log before reporting that one is already running, and the running update's initramfs check then read the wrong transcript. Check the lock before script(1) starts; the lock itself is still taken inside the transcript, so a terminal that closes releases it with the update.
ffa8ae6 to
a00bcf2
Compare
The lock probe left a window: two updates started together could both pass it, and the loser's script(1) then truncated the winner's transcript. script(1) now appends, so opening the transcript never wipes it, and the update clears it only once it holds the lock. The probe is no longer needed.
The update now clears its transcript once it holds the lock, so the fresh case cleared the real /tmp/omarchy-update.log. Point the copied updater at the test's own directory, as update-lock-test.sh does.
|
Reviewed d529422: the logger, lock, analyzer, transcript tests, and related pull requests. This is a different fix for the same log-loss problem as #13937: that change gives every invocation its own transcript, so a rejected second invocation never opens the running update's file. The older fix takes precedence in the queue; both pull requests remain open for the maintainer's decision. The regression scenario here is worth retaining: two fresh updates through the real Codex (high effort) reviewed the code and comparison; Opus 5.5 (high effort) and muse-wonder via pi (high thinking) also compared the fixes and agreed on #13937 under the oldest-first rule. Their independence is not guaranteed. Tests were not run on this revision because verification pauses for the competing fix; the previous review's results cover an older head. This item waits on the maintainer's choice between the fixes. |
Adapt the overlapping-update regression from omacom#17020 to real script and lock entry points, and check the analyzer against current and legacy transcripts. This replaces the extracted-wrapper test and keeps fresh update and hangup fixtures inside their own temporary directories. Document how to analyze a retained transcript explicitly. Co-Authored-By: sundarshahi <shahithakurisundar@gmail.com> Co-Authored-By: GPT-6 High <noreply@openai.com>
Starting
omarchy updatewhile one is already running wipes the running update's transcript.omarchy-updatere-execs itself underscript -qefc … /tmp/omarchy-update.logfirst and only takes the update lock inside that, so the second run'sscript(1)truncates the shared transcript on open, and only then reaches the lock and prints "An Omarchy update is already running." The first update keeps writing at its old offset, so everything it logged before the truncation is gone, and its closingomarchy-update-analyze-logsgreps the damaged file. If the second run lands during the package upgrade, the "Updating linux initcpios" line is lost and the initramfs failure warning, the one that says to review the logs before restarting, cannot fire.script(1)now opens the transcript with-a, so opening it never truncates it, and the update clears it itself once it holds the lock. Only the update that holds the lock ever clears the transcript, so a second update cannot wipe a running one's log, however close together they start. The order is unchanged from #16045: the transcript first, the lock inside it, so a terminal that closes still releases the lock with the update. The cost: a rejected second update's "already running" lines are appended to the running update's transcript.Rebased on #16045. This PR first took the lock before the transcript instead, but then
script(1)inherits the lock and keeps it while it shuts down, so closing the terminal no longer frees it at once:update-hangup-test.shfailed in 12 of 12 runs that way. A second version checked the lock beforescript(1)started, which left a window for two updates started at the same instant.Testing, on the CI VM (Omarchy image,
test/ci-vm):update-hangup-test.shalone, 12 copies, run side by side: 5 of 12 fail with this change and 5 of 12 onquattro, all at its lock check withBlockingIOError, so the test fails at random on its own. With the lock taken before the transcript it failed 12 of 12.-a,update-lock-test.shfails withnot ok - second omarchy-update left the running update's transcript alone. Without the clear under the lock, it fails withnot ok - update started its transcript afresh.update-user-path-test.shnow points the copied updater at its own transcript, asupdate-lock-test.shdoes, because an update now clears the transcript once it holds the lock. With a host transcript in place, it survives the test, and is cleared with that redirect removed.The overlapping-updates test in
update-lock-test.shstarts both updates fresh through the realscript(1), with the transcript moved into the test's directory. It checks that the first update's output survives the second, and that a previous run's transcript is cleared.This touches the lines next to #17012, which moves the transcript out of
/tmp; whichever merges second needs a small rebase.