Repository navigation
Conversation
Two accounts sharing the hard-coded /tmp/omarchy-update.log broke the second user's update: with fs.protected_regular=1, script(1) cannot open a transcript another account owns in sticky /tmp, so the update ended before doing anything (omacom#15679). Log to ${XDG_RUNTIME_DIR:-/tmp}/omarchy-update-$UID.log, the same rule the update lock already follows, and teach omarchy-update-analyze-logs the same path.
[Medium impact] The PR appears safe to merge; both previous findings are addressed. SummaryThe PR moves update transcripts to
Reviews (2) · Last reviewed commit: "update: analyze the legacy transcript on..." · Reviewed by Greptile |
|
Thanks for this. I read the diff at 3aa2106 against Two points from reading the source, with nothing executed yet. Both match what Greptile raised:
Next, this waits on the second opinion. Neither point needs anything from you yet: the next pass will verify both on a worker and push a fix where one is needed. |
| printf 'Updating linux initcpios\n' >"/tmp/omarchy-update-$UID.log" | ||
| out=$(env -u XDG_RUNTIME_DIR "$SUDO_TEST_ROOT/bin/omarchy-update-analyze-logs") | ||
| [[ $out == *"Initramfs generation may have failed"* ]] || | ||
| fail "analyze-logs reads the /tmp fallback transcript" "got: $out" | ||
| rm -f -- "/tmp/omarchy-update-$UID.log" |
There was a problem hiding this comment.
Hi @AnPod, #16100 builds on this PR and carries your commit unchanged. Here's a fix for this finding that you can commit directly: the copied analyzer falls back to the test's own directory instead of the real /tmp, so a transcript an earlier update left there is never touched. Do you plan to address the other finding (the first update missing its log) too?
| printf 'Updating linux initcpios\n' >"/tmp/omarchy-update-$UID.log" | |
| out=$(env -u XDG_RUNTIME_DIR "$SUDO_TEST_ROOT/bin/omarchy-update-analyze-logs") | |
| [[ $out == *"Initramfs generation may have failed"* ]] || | |
| fail "analyze-logs reads the /tmp fallback transcript" "got: $out" | |
| rm -f -- "/tmp/omarchy-update-$UID.log" | |
| # The copy falls back to this test's directory, not the real /tmp, so a | |
| # transcript an earlier update left there is never touched. | |
| sed -i "s|:-/tmp}|:-$test_tmp}|" "$SUDO_TEST_ROOT/bin/omarchy-update-analyze-logs" | |
| printf 'Updating linux initcpios\n' >"$test_tmp/omarchy-update-$UID.log" | |
| out=$(env -u XDG_RUNTIME_DIR "$SUDO_TEST_ROOT/bin/omarchy-update-analyze-logs") | |
| [[ $out == *"Initramfs generation may have failed"* ]] || | |
| fail "analyze-logs reads the /tmp fallback transcript" "got: $out" |
…s, keep tests out of /tmp The update that installs the per-user path is still run by the old omarchy-update, which logged to /tmp/omarchy-update.log. Fall back to that file when the per-user log does not exist, and stay quiet when neither does. The test's copied analyzer now falls back to the test directory, so it never writes or deletes a real transcript in /tmp.
|
I read the new commit, 0049516, against Both points from the last comment are addressed in the source:
Next, this waits on the second opinion. After that, a worker run will reproduce the failure on |
Fixes #15679.
Problem
omarchy updatewrites itsscript(1)transcript to the hard-coded/tmp/omarchy-update.log. With two accounts on one machine, the first user's run leaves that file owned by them; with Arch's defaultfs.protected_regular=1, the second user'sscript -qefc …re-exec cannot open it for writing, so their update exits immediately and the floating update terminal just flashes and closes.Fix
The transcript now goes to
${XDG_RUNTIME_DIR:-/tmp}/omarchy-update-$UID.log— the same rule the update lock already uses (omarchy-update-lock's${XDG_RUNTIME_DIR:-/tmp}).omarchy-update-analyze-logsresolves the identical path, so the post-update initramfs check keeps reading the right transcript in both environments.docs/update-process.mdupdated to match.Test
New
test/shell.d/update-log-path-test.sh(auto-discovered bytest/shell), using the existing sudo-boundary fixture withscript(1)stubbed to record the typescript path:XDG_RUNTIME_DIRset, the updater hands script$XDG_RUNTIME_DIR/omarchy-update-$UID.log/tmp/omarchy-update-$UID.logfallbackomarchy-update-analyze-logsreports the initramfs failure from a transcript planted at both resolved pathsVerified red/green: the test fails against clean quattro (records
/tmp/omarchy-update.log) and passes with the change.update-sequence-test.sh,update-lock-test.shandupdate-disk-space-test.shstill pass.