Survive an unset OMARCHY_PATH in the update pipeline - #11111
Open
aholbreich wants to merge 2 commits into
Open
Conversation
`sudo omarchy update` aborted right after the snapshot with `/usr/bin/omarchy-update-dev: line 7: OMARCHY_PATH: unbound variable`, before any package was upgraded. OMARCHY_PATH is established by default/bash/env-bootstrap, which runs only from a login shell, an interactive rc, or the uwsm session environment. sudo execs the router directly under its default env_reset and omarchy-update re-execs itself through `script -qefc`, so none of those run and the variable is unset. Both scripts are `set -u` and dereference it bare, which kills omarchy-update-dev and fires the ERR trap in omarchy-update. omarchy-update-available is reached from the same run through omarchy-update-status, where its death reads as "no updates". /usr/share/omarchy is the value env-bootstrap itself picks when no dev-link config is present, and omarchy-migrate already defaults the same way one step later in this pipeline. A dev-linked checkout is therefore not pulled under sudo, which is the safe branch: omarchy-dev-link grants sudo a secure_path and no env_keep, and pulling a user-owned checkout as root would leave root-owned objects behind. This stops the abort; it does not make a root-run update correct. Whether `sudo omarchy update` should be supported at all is a separate question. Co-Authored-By: Codex XHigh <codex@openai.com>
sudo's env_reset drops OMARCHY_PATH. Defaulting straight to the packaged tree silently skipped a dev-linked checkout in omarchy-update-dev and made omarchy-snapshot print a bare /install/config path. Resolve from the root-owned /etc/omarchy.conf that omarchy-dev-link writes, and warn instead of pulling a user-owned checkout as root. Documents the root-entry-point exception in AGENTS.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sudo omarchy updateaborts right after the snapshot —OMARCHY_PATH: unbound variable— before anything upgrades. On a dev-linked box it also silently skipped the dev checkout and printed a broken snapper setup path.OMARCHY_PATHis set bydefault/bash/env-bootstrap, which only runs from a login shell, an interactive rc, or the uwsm session.sudoruns the router underenv_reset, so the variable is gone and nothing re-establishes it.Changes:
omarchy-update-devandomarchy-snapshotresolve an unsetOMARCHY_PATHfrom the root-owned/etc/omarchy.confthatomarchy-dev-linkwrites, falling back to/usr/share/omarchy.omarchy-update-devskips a dev-linked checkout when run as root and says so, instead of exiting silently — pulling a user-owned checkout as root would leave root-owned objects behind.omarchy-snapshotprints the checkout's real snapper path instead of a bare/install/config.omarchy-update-availablekeeps the plain packaged default: itsgit fetchshouldn't run as root on a user checkout.This stops the abort. It doesn't make a root-run update correct — migrations, hooks, AUR/mise updates, and
omarchy-restart-shellstill read root's$HOME. Whethersudo omarchy updateshould be supported, refused, or drop privileges is a separate call.Fixes #8369
Fixes #9953