From 99baed1a0f61ce32bb663acd4380a399cefd36d1 Mon Sep 17 00:00:00 2001 From: Americo Savinon Date: Thu, 10 Sep 2026 08:58:56 +0000 Subject: [PATCH 1/2] fix(update): default OMARCHY_PATH under sudo nounset Under sudo, OMARCHY_PATH is unset and set -u aborts omarchy-update-dev. Default to /usr/share/omarchy so non-dev installs still early-exit. Fixes #11065 --- bin/omarchy-update-dev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-update-dev b/bin/omarchy-update-dev index a973246ebe8..992e8743e2a 100755 --- a/bin/omarchy-update-dev +++ b/bin/omarchy-update-dev @@ -4,7 +4,7 @@ set -euo pipefail -[[ $OMARCHY_PATH != "/usr/share/omarchy" ]] || exit 0 +[[ ${OMARCHY_PATH:-/usr/share/omarchy} != "/usr/share/omarchy" ]] || exit 0 if ! git -C "$OMARCHY_PATH" rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo "Error: OMARCHY_PATH is not a git checkout: $OMARCHY_PATH" >&2 @@ -18,4 +18,4 @@ if [[ -z $upstream ]]; then fi echo -e "\e[32m\nUpdate Omarchy dev checkout\e[0m" -git -C "$OMARCHY_PATH" pull --ff-only +git -C "$OMARCHY_PATH" pull --ff-only \ No newline at end of file From d1d82da493f356b2ea53674d7319d661a3dd65a9 Mon Sep 17 00:00:00 2001 From: Americo Savinon Date: Thu, 10 Sep 2026 09:05:58 +0000 Subject: [PATCH 2/2] test(update-dev): cover unset OMARCHY_PATH under nounset Mimics sudo wiping the environment so the early-exit default stays covered. --- test/shell.d/update-dev-test.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/shell.d/update-dev-test.sh b/test/shell.d/update-dev-test.sh index 68da418a488..544dced7557 100644 --- a/test/shell.d/update-dev-test.sh +++ b/test/shell.d/update-dev-test.sh @@ -58,6 +58,20 @@ run_dev_update /usr/share/omarchy [[ ! -s $git_log ]] || fail "package-backed updates do not invoke git" "$(cat "$git_log")" pass "package-backed updates skip the dev checkout step" +# Mimic `sudo` wiping the environment: OMARCHY_PATH must not unbound-error under set -u. +: >"$git_log" +if ! env -u OMARCHY_PATH \ + TEST_GIT_LOG="$git_log" \ + PATH="$stub_bin:$PATH" \ + "$ROOT/bin/omarchy-update-dev" >"$test_tmp/unset.out" 2>"$test_tmp/unset.err"; then + fail "unset OMARCHY_PATH exits cleanly (sudo-like)" "$(cat "$test_tmp/unset.err")" +fi +if grep -Fq "OMARCHY_PATH: unbound variable" "$test_tmp/unset.err"; then + fail "unset OMARCHY_PATH does not trip nounset" "$(cat "$test_tmp/unset.err")" +fi +[[ ! -s $git_log ]] || fail "unset OMARCHY_PATH does not invoke git" "$(cat "$git_log")" +pass "unset OMARCHY_PATH (sudo-like) skips without unbound-variable" + : >"$git_log" run_dev_update "$checkout" grep -Fx -- "-C $checkout pull --ff-only" "$git_log" >/dev/null || @@ -81,4 +95,4 @@ pass "invalid dev checkout fails with a useful error" grep -qE '^ *omarchy-update-dev$' "$ROOT/bin/omarchy-update" || fail "top-level update includes the dev checkout step" -pass "top-level update includes the dev checkout step" +pass "top-level update includes the dev checkout step" \ No newline at end of file