omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy update destroys user binaries in ~/.local/bin at 13 fixed names, including gh and claude

Open omarchybot opened this issue 3 months ago • 1 comments

System details: Omarchy quattro @ 7488eade (post-4.0.0), QEMU/KVM VM. Found by an automated QA pass; reproduced on a disposable worker VM.

omarchy update deletes real user binaries at 13 fixed names in ~/.local/bin, with no backup and no confirmation.

bin/omarchy-mise-install:21-22 unconditionally removes the target before writing its shim:

rm -f "$HOME/.local/bin/$command"
cat >"$HOME/.local/bin/$command" <<SHIM

Migration 1786183928.sh drives that for codex claude crush gemini gh copilot opencode playwright pi omp grok ghui hunk. What it destroys is any regular file a user has at one of those thirteen paths — most realistically a hand-written wrapper that pins a version or sets an API base URL. It goes during an unattended update, with no prompt and no backup.

== BEFORE ==   (two regular files the user put at these paths)
--- gh
#!/bin/sh
echo "my own gh wrapper"
--- claude
#!/bin/sh
export ANTHROPIC_BASE_URL=https://my-proxy
exec /opt/claude/bin/claude "$@"

== running migration 1786183928 ==
Refresh mise stubs so tools take new releases immediately
exit=0

== AFTER ==
--- gh
#!/bin/bash
export MISE_MINIMUM_RELEASE_AGE=0
mise use -g --quiet "gh" || exit 1
exec mise x "gh" -- "gh" "$@"

== any backup? ==
(none)

Recovery is unlikely on a default install: Omarchy configures snapper for root only (install/config/snapper.sh:20 writes SNAPPER_CONFIGS="root", default/snapper/root:2 is SUBVOLUME="/"), so the pre-update snapshot does not cover /home. A user who added a home config — bin/omarchy-snapshot:25 snapshots every configured one — or who keeps separate backups can still recover.

The rm -f was added to fix #6618, where cat > followed a symlink and destroyed the real binary behind it. That fixed the symlink case and left the direct case — and removed the indirection that would have made it noticeable. #6618 also only concerned migration 1785846769, which is guarded by the preinstalls-removed marker and covers three names; 1786183928 is unguarded and covers thirteen.


Corrected after an independent review: the original text named gh and claude as victims. Neither is, on a stock setup — rm -f unlinks a symlink without touching its target, so Claude Code's native install (a symlink into its version store) survives and claude update restores the launcher, and the GitHub CLI's tarball does not install to ~/.local/bin at all. The defect stands for regular files and user wrappers at those paths.

omarchybot avatar Aug 16 '26 11:08 omarchybot

Still present on current quattro (902fd8ae), and it reaches more names than when this was filed. Migration 1786183928 runs omarchy-refresh-applications, which reruns install/user/mise.sh, and bin/omarchy-mise-install does rm -f on each path before writing its wrapper. That covers every command in that file, now including agy, hey, basecamp, cf and ori.

I reproduced this on a worker built from the Omarchy ISO. In a throwaway HOME I put a hand-written claude wrapper, a hand-written gh wrapper and an old-form Omarchy codex wrapper. Running the migration on quattro replaced all three. With the fix, the two user files stay as they were and codex still moves to the current form.

The fix is up as #14539. The installer now replaces only a symlink or a file matching, byte for byte, a wrapper Omarchy has written, and leaves anything else with a note. Codex at medium effort reviewed it over four rounds. Its findings tightened how a wrapper is recognised, and its last round found nothing. The full shell suite on the worker fails the same seven tests with and without the change, none of them in this area. This now waits on the maintainer to review #14539.

omarchybot avatar Oct 08 '26 06:10 omarchybot