Skip to content

Default OMARCHY_PATH in omarchy-update-available - #8771

Open
tpatzelt wants to merge 1 commit into
omacom:quattrofrom
tpatzelt:default-omarchy-path-in-update-available
Open

tpatzelt wants to merge 1 commit into
omacom:quattrofrom
tpatzelt:default-omarchy-path-in-update-available

Conversation

@tpatzelt

Copy link
Copy Markdown

Fixes #8769.

Problem

omarchy-update-available runs under set -euo pipefail and dereferences $OMARCHY_PATH bare on line 9, the check that decides whether the install is a dev checkout:

if [[ $OMARCHY_PATH != "/usr/share/omarchy" ]]; then

Any context that never sourced default/bash/rc reaches it unset — a sudo'd update under the default env_reset, a non-login SSH session:

$ env -u OMARCHY_PATH bin/omarchy-update-available
bin/omarchy-update-available: line 9: OMARCHY_PATH: unbound variable

This is the same defect #8369 reports in omarchy-update-dev, in the sibling script. #8590 fixes only omarchy-update-dev, so on the sudo omarchy update path it moves the crash rather than removing it: the update clears the dev-checkout step and then hits the identical error here.

omarchy-update-status calls this near the end of every update, and the failure is silent:

if omarchy-update-available >/dev/null; then
  omarchy-shell -q omarchy.system-update refresh
else
  omarchy-shell -q omarchy.system-update clear
fi

omarchy-update-available exits 1 both when Omarchy is up to date and when it crashes, and the if consumes that status. The crash therefore takes the clear branch: the bar's update indicator is cleared as though the system were current, and since only stdout is redirected the sole trace is a stray unbound variable line in the update output.

#7398 also touches this file, but rewrites the comparison as ${OMARCHY_PATH%/} — still a bare dereference under set -u — so it does not cover this either. The two changes don't conflict; whichever lands second keeps the default.

Fix

The established pattern, already used in default/bash/rc, default/bash/env-bootstrap, bin/omarchy-migrate and bin/omarchy-version:

: "${OMARCHY_PATH:=/usr/share/omarchy}"

An unset OMARCHY_PATH now classifies the install as package-backed and skips the dev-checkout branch, which is exactly what it means. Dev checkouts with the variable exported are unaffected, and the package/checkupdates half of the script never read it.

This matches the fallback #8590 adds to omarchy-update-dev; it is repeated locally here for the same reason given there — the command is reachable standalone from environments that never source Omarchy's shell bootstrap.

Testing

Added a case to test/shell.d/update-available-test.sh that runs the real command with OMARCHY_PATH unset and asserts it exits 1 with the up-to-date message, stays quiet on stderr, and issues no git calls (proving it classified the install as package-backed rather than probing a checkout at "").

ok - update checker defaults OMARCHY_PATH when the environment does not carry it

Mutation-checked: reverting the one-line default fails the new case with the exact reported error, and no other case in the file notices.

Also passing: bin-style-test, update-status-test, update-sequence-test, update-lock-test, ./test/cli, bash -n on both changed files, and git diff --check.

omarchy-update-available runs under set -euo pipefail and dereferences
$OMARCHY_PATH bare on the check that decides whether the install is
package-backed, so any context that never sourced default/bash/rc kills
it with "unbound variable" -- a sudo'd update under the default
env_reset, or a non-login SSH session.

omarchy-update-status calls it near the end of every update, and it
exits 1 both when Omarchy is up to date and when it crashes. The status
script consumes that in an if, so the crash takes the clear branch and
the bar's update indicator is cleared as though the system were current,
leaving only a stray unbound-variable line behind.

Default the variable the way default/bash/rc, default/bash/env-bootstrap,
omarchy-migrate and omarchy-version already do. An unset OMARCHY_PATH
now classifies the install as package-backed and skips the dev-checkout
check, which is what it means.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 28, 2026 15:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Defaults OMARCHY_PATH when checking for updates and adds regression coverage for unset environments.

Changes:

  • Adds a package-install fallback for OMARCHY_PATH.
  • Tests exit status, output, stderr, and skipped Git operations.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
bin/omarchy-update-available Adds the environment fallback.
test/shell.d/update-available-test.sh Adds unset-variable regression coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@omarchybot

Copy link
Copy Markdown
Collaborator

I reviewed this against current quattro (c05d901) on a disposable Omarchy worker. The crash is real for a standalone call, and this fixes it. But the path the description points to, a sudo'd omarchy update, no longer reaches this script, and the change goes against a rule in the base branch's AGENTS.md. So this is the maintainer's call.

What ran on the worker:

  • env -u OMARCHY_PATH bin/omarchy-update-available on quattro fails with line 9: OMARCHY_PATH: unbound variable. With this PR merged onto quattro, it prints Omarchy is up to date.
  • The new case in test/shell.d/update-available-test.sh passes with the fix (9/9) and fails with the one-line default reverted (8/9, the same unbound-variable error), so it is not vacuous. update-status-test and bin-style-test pass. ./test/cli has one failure, vscode generated theme references current theme file, and it fails the same way on quattro without this PR.
  • env -u OMARCHY_PATH bin/omarchy-update -y on quattro, with or without this PR, stops at OMARCHY_PATH does not match this Omarchy command. That is omarchy_security_require_source_root at bin/omarchy-update:19, well before omarchy-update-status at line 133. The branch this PR was cut from predates that guard. So on current quattro an update with OMARCHY_PATH unset never gets far enough to clear the bar's indicator.

Other callers: the bar widget (shell/plugins/bar/widgets/SystemUpdate.qml:41) runs in the session environment, and omarchy-upgrade-to-quattro passes OMARCHY_PATH=/usr/share/omarchy explicitly. The only way left to hit this is calling the command by hand from a shell that never loaded Omarchy's environment.

For the maintainer:

Second opinion: none. Codex Medium answered the availability check, but the review itself was refused because the day's review budget was spent. This is one model's reading, plus the worker runs above. No verified or ready label: it waits on the maintainer to decide whether a standalone-invocation default is wanted, given the rule.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-update-available has the same unbound $OMARCHY_PATH crash as #8369, and it silently clears the update indicator

3 participants