Skip to content

Log the update transcript to a per-user path - #15683

Open
AnPod wants to merge 2 commits into
omacom:quattrofrom
AnPod:update-log-per-user-path
Open

AnPod wants to merge 2 commits into
omacom:quattrofrom
AnPod:update-log-per-user-path

Conversation

@AnPod

@AnPod AnPod commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #15679.

Problem

omarchy update writes its script(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 default fs.protected_regular=1, the second user's script -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-logs resolves the identical path, so the post-update initramfs check keeps reading the right transcript in both environments. docs/update-process.md updated to match.

Test

New test/shell.d/update-log-path-test.sh (auto-discovered by test/shell), using the existing sudo-boundary fixture with script(1) stubbed to record the typescript path:

  • with XDG_RUNTIME_DIR set, the updater hands script $XDG_RUNTIME_DIR/omarchy-update-$UID.log
  • without it, the per-user /tmp/omarchy-update-$UID.log fallback
  • omarchy-update-analyze-logs reports the initramfs failure from a transcript planted at both resolved paths

Verified 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.sh and update-disk-space-test.sh still pass.

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.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed.

Summary

The PR moves update transcripts to ${XDG_RUNTIME_DIR:-/tmp}/omarchy-update-$UID.log so accounts no longer share one file.

  • Each update keeps its transcript in a path for that user.

Reviews (2) · Last reviewed commit: "update: analyze the legacy transcript on..." · Reviewed by Greptile

Comment thread bin/omarchy-update-analyze-logs Resolved
Comment thread test/shell.d/update-log-path-test.sh Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. I read the diff at 3aa2106 against quattro, along with #15679 and the update scripts it touches. I haven't classified it or run it yet. Every item gets a second reviewer (Codex Medium here), and today's review budget for that reviewer is spent, so the classification check came back unreviewed. Until two models agree on a class, this gets no labels and no worker run. It will go round again once the reviewer is available.

Two points from reading the source, with nothing executed yet. Both match what Greptile raised:

  • bin/omarchy-update-analyze-logs:7: the update that installs this change is still run by the old omarchy-update, which opened /tmp/omarchy-update.log before the packages changed. The newly installed analyzer then reads the per-user path, which doesn't exist yet. On that one update the initramfs check is skipped, and grep prints a "No such file or directory" error.
  • test/shell.d/update-log-path-test.sh:55-59: the fallback assertion writes the real /tmp/omarchy-update-$UID.log and then deletes it. Running the suite would erase the transcript of the account running it.

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.

Comment thread test/shell.d/update-log-path-test.sh Outdated
Comment on lines +55 to +59
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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Suggested change
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.
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the new commit, 0049516, against quattro. The second reviewer (Codex Medium) is out of review budget again today, so the classification check came back unreviewed. That means no labels and no worker run yet, and this goes round again once the reviewer is available. Nothing below has been executed. It is from reading the source, by Claude Opus 5.5 alone.

Both points from the last comment are addressed in the source:

  • bin/omarchy-update-analyze-logs falls back to /tmp/omarchy-update.log when the per-user transcript does not exist yet, which covers the one update run by the old omarchy-update. The -r guard keeps it quiet when neither file exists. No other script on quattro reads the old path.
  • test/shell.d/update-log-path-test.sh now points the copied analyzer's fallbacks at the test's own directory, so the suite no longer writes or deletes a real transcript in /tmp.

Next, this waits on the second opinion. After that, a worker run will reproduce the failure on quattro and check this head. You don't need to do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy update fails for a second user when another user's /tmp/omarchy-update.log exists

3 participants