Skip to content

Refuse an unknown argument to omarchy update before anything runs - #16777

Open
Hamza0101 wants to merge 2 commits into
omacom:quattrofrom
Hamza0101:update-rejects-unknown-arguments
Open

Hamza0101 wants to merge 2 commits into
omacom:quattrofrom
Hamza0101:update-rejects-unknown-arguments

Conversation

@Hamza0101

@Hamza0101 Hamza0101 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

omarchy update firmwre (meant: omarchy update firmware) starts a full system update. The router resolves a command it can't find to the nearest one it can, so the typo arrives as omarchy-update firmwre, and omarchy-update only ever looks at whether $1 is -y. Everything else is ignored: the user confirms what looks like the usual prompt and gets the package prune, the snapshot, the full upgrade, migrations, AUR and mise, which the prompt itself says can't be stopped once started. omarchy update aur pkg does the same, and so does -y anywhere but alone. That is #16770.

The issue suggests teaching the router to reject a leftover word for every group. That changes how every command receives its arguments and is a bigger call; this does the part that matters most on its own. omarchy-update takes no argument but -y, so anything else is refused first thing, right after set -e, before the sudo prompt, the lock, the log or any step:

$ omarchy update firmwre
omarchy update: unknown argument: firmwre
Usage: omarchy update [-y]

It exits 2. omarchy update and omarchy update -y are unchanged, and the updater's own re-execs for logging and the lock pass the same arguments through, so they are unaffected. The only caller inside Omarchy, omarchy-channel-set, passes -y.

Reproduce on a VM

$ omarchy update firmwre

On quattro this shows the usual "Ready to update?" confirmation, and answering yes runs the whole update. On this branch it prints

omarchy update: unknown argument: firmwre
Usage: omarchy update [-y]

and exits 2 before asking for a password. omarchy update -y aur and omarchy update aur -y behave the same way; omarchy update and omarchy update -y are unchanged.

Validation

  • test/shell.d/update-sequence-test.sh gains one case: firmwre, aur pkg, -y firmwre and firmwre -y are each refused with the usage line, and no step runs, the confirmation included. In an Arch container, with the change, it passes along with update-user-path, update-disk-space, update-hook-security, update-boot-verify, channel-sudo-boundary, snapshot-create and security-source-root. With bin/omarchy-update reverted, it fails at an update given 'firmwre' is refused. update-lock-test.sh fails in that container on the base as well, before this change.
  • bash -n, git diff --check and scripts/i18n-sync.py extract-scan --check pass. Not run on an Omarchy install.

Human check

omarchy update firmwre should print the two lines above and return without asking for a password. omarchy update should still show the usual confirmation.

@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; unsupported arguments stop early and supported calls remain unchanged.

Summary

omarchy-update now rejects unsupported arguments before logging, locking, confirmation, or sudo.

  • The updater accepts only no argument or a lone -y.

No actionable issues were found. This review checked the code and callers; it did not run tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start update] --> B{No arguments or only -y?}
  B -->|No| C[Print error and usage]
  C --> D[Exit 2]
  B -->|Yes| E[Logging and update lock]
  E --> F[Existing update flow]
Loading

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/qua..." · Reviewed by Greptile

@omarchybot omarchybot added the bug Something isn't working label Nov 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this, @Hamza0101. The guard does what it says: on this head, firmwre, aur pkg, -y firmwre and firmwre -y are all refused before the confirmation or any step, and a direct omarchy-update firmwre call is refused too.

Two other open pull requests fix #16770 in the dispatcher, where the bug actually comes from: #16944 and #17016. I read all three against quattro and did not run any of them. I'm recommending #16944 to the maintainer as the fix for the issue, even though this one is older, because a script-level guard leaves the same bug in other group parents. For example, bin/omarchy-reinstall takes no arguments and never reads them, so omarchy reinstall configz (meant: omarchy reinstall configs) still goes to the "reinstall and lose config changes?" prompt and, if confirmed, reinstalls the packages and resets every config. #16944 refuses a bare word after any group parent whose omarchy:args names no operand, and that includes this case. #17016 checks only the first leftover word, so omarchy update -y firmwre would still start an unattended full update.

This change still adds something #16944 does not: it covers calls that never go through bin/omarchy (omarchy-update firmwre run directly) and omarchy update -- firmwre. The maintainer may want both. Separately, bin/omarchy-update has changed on quattro since this was opened, and the startup block this guard sits under is gone, so the branch now conflicts there. The test file still merges cleanly.

Second opinion: Codex Medium agreed that the guard has no defect and that the branch conflicts with quattro (independence not guaranteed), but it could not read the other two pull requests, so it gave no view on which fix should win. muse-wonder (via pi, thinking high) raised the omarchy reinstall case and the -y firmwre gap in #17016. I checked both against quattro. I set aside its claim that this branch merges cleanly, because a three-way merge with quattro conflicts in bin/omarchy-update.

Waiting on the maintainer to choose between the fixes for #16770.

…nown-arguments

# Conflicts:
#	bin/omarchy-update
@Hamza0101

Copy link
Copy Markdown
Contributor Author

Merged quattro in (9c63ac5). #17000 removed the startup block the guard sat under, so it now sits directly after set -e, still before the confirmation, the lock and any step. In an Arch container update-sequence-test.sh passes 8/8 with it, and with quattro's bin/omarchy-update the new case fails at an update given 'firmwre' is refused. The other update tests pass, apart from update-lock and update-restart-kernel, which fail the same way on quattro's updater in that container.

On #16944: agreed, the router is where #16770 comes from, and it covers omarchy reinstall configz, which this can't. I'd be glad for #16944 to land as the fix for the issue. This one only adds the two cases you named, omarchy-update firmwre run directly and omarchy update -- firmwre, and it is three lines in one script, so it sits fine beside #16944. If the maintainer prefers one change, closing this in favour of #16944 is fine by me.

@omarchybot

Copy link
Copy Markdown
Collaborator

The startup conflict was resolved in 9c63ac5. I checked the revised diff, your reply, #16770 and the current competing fixes. Against current quattro, bin/omarchy-update merges cleanly; the remaining conflict is in test/shell.d/update-sequence-test.sh, where the argument-rejection loop and the new no-pending-migrations case both need to be retained.

#16944 remains the broader fix for the reported dispatcher bug: it also rejects a typo after omarchy reinstall, which this updater-only guard cannot cover. #17016 has closed without merging. This guard still adds useful protection alongside #16944 for direct omarchy-update calls, unknown flags such as --yes, and omarchy update -- firmwre; the router patch passes those through. No defect was found in the guard itself.

GPT-6 in Codex (reasoning effort not exposed) reviewed this revision, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. Both agreed that #16944 should carry the broader fix while preserving this endpoint protection; independence is not guaranteed. The reviews also identified the unknown-flag coverage, which I checked against both diffs. This was a source-and-diff comparison on the coordinator; no worker tests ran because this PR remains behind the competing fix, and no code was changed or pushed.

Waiting on the maintainer to decide whether to retain this guard separately or include it in #16944. If included there, its direct-call tests should retain Hamza0101's contribution and add an explicit -- firmwre case.

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.

2 participants