Skip to content

Accept the -- operand separator in the kernel migration test pacman stubs - #13061

Closed
en3r0 wants to merge 1 commit into
omacom:quattrofrom
en3r0:fix-kernel-migration-test-pacman-stub
Closed

en3r0 wants to merge 1 commit into
omacom:quattrofrom
en3r0:fix-kernel-migration-test-pacman-stub

Conversation

@en3r0

@en3r0 en3r0 commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

#11495 (b72d7e5) changed omarchy-pkg-present and omarchy-pkg-add to pass -- before package names:

  • pacman -Q -- <pkg>
  • pacman -S --noconfirm --needed -- <pkgs>

The review on that PR caught the pacman stubs in fingerprint-driver-migration-test.sh, fingerprint-package-test.sh and menu-guards-test.sh, which were fixed before merge. Two kernel migration tests still read the package name from a fixed position:

  • omarchy-kernel-migration-test.sh: the stub runs grep -Fxq "$2" "$INSTALLED_PACKAGES", which becomes grep -Fxq -- <packages-file>. The file path is taken as the pattern and there is no file operand, so grep reads stdin.
    • With stdin closed or /dev/null, as in a normal CI run, the file fails before its first assertion.
    • With stdin left open (for example ./test/all run from an agent harness or a pipe), it blocks indefinitely. I hit a 74-minute hang this way.
  • kernel-headers-migration-test.sh: the stub already passes -- to grep but still uses $2, so every package lookup searches for a package literally named -- and fails ("linux-omarchy gets its headers"). Its -S branch also records the -- as an installed package.

Changes

  • Both -Q stubs skip an optional --, using the same if [[ $2 == "--" ]]; then shift 2; else shift; fi pattern the fingerprint and menu-guard stubs use.
  • The headers stub's -S branch drops the -- before recording packages.
  • The kernel migration test's expected install call now includes the separator: pacman -S --noconfirm --needed -- linux-omarchy linux-omarchy-headers, matching the fingerprint test's expectation.

No other test/shell.d stub reads $2 after -Q without handling --.

Tests

Test Before After
omarchy-kernel-migration-test.sh, stdin /dev/null fails, 0 assertions run 19/19 ok, ~1s
omarchy-kernel-migration-test.sh, stdin open pipe hangs (killed by timeout 60) 19/19 ok, ~2s
kernel-headers-migration-test.sh not ok - linux-omarchy gets its headers 5/5 ok

Full ./test/all on this branch goes from 7 failing files to 5. The same 5 fail on unmodified quattro on this machine.

None of the remaining failures come from this change. I checked each one:

  • config-test.sh, unowned-system-paths-test.sh, snapper-test.sh: these need local checkouts of omarchy-pkgs (and omarchy-iso for snapper). With both cloned, all three pass.
  • screenshot-sanity-test.sh: this needs omasnap. It was added to omarchy-base.packages in e265934 but isn't installed on this machine, which runs Omarchy 4.0.4.
  • test/cli: "vscode generated theme references current theme file" is a stale check. Make VS Code-family editors reload the Omarchy theme when it changes #10134 deliberately switched omarchy-theme-set-vscode from a symlink to a real file with a content-derived version, but the test still expects the symlink. Behind it, the .obsolete check still seeds version 1.0.0. This fails on unmodified quattro too; it is fixed in Update the VS Code theme CLI checks for the copied theme file #13065.
  • runtime-smoke-test.sh: "each widget registers its IPC handler once per screen (saw 8 for 3 screen(s))" also fails on unmodified quattro. The live Omarchy 4.0.4 shell on this 3-monitor machine logs similar bursts of duplicate IPC handler registrations for every bar widget, so this may be a real multi-monitor issue rather than an environment quirk. I haven't investigated it further.

🤖 Generated with Claude Code

…tubs

omarchy-pkg-present and omarchy-pkg-add now pass -- before package names
(b72d7e5), but these two stubs still read the package from a fixed position.
The kernel migration stub ran grep with -- as its pattern and no file, so it
blocked on stdin; the headers stub looked up a package named "--".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Guistoff081

Copy link
Copy Markdown

Confirming this fixes the hang. I hit it while running ./test/all for #13070: with stdin left open (a background agent shell), omarchy-kernel-migration-test.sh sat in the stub's grep -Fxq -- <packages-file> reading stdin for ~19 minutes until I killed it. The headers test was failing with "linux-omarchy gets its headers".

I applied this PR's diff to current quattro (28ceaae) and reran both files with stdin held open:

Test quattro With #13061
omarchy-kernel-migration-test.sh hangs 19/19 ok, 2s
kernel-headers-migration-test.sh fails 5/5 ok

Tested on Omarchy 4.0.4, Hyprland 0.56.2.

@HerrStolzier

Copy link
Copy Markdown
Contributor

Independent, AI-assisted verification of a883efca072b62969e497af2cf376770b3360926, with one additional regression-test suggestion.

The fix is already covered by this PR, so I am contributing verification and a targeted test addition rather than opening a duplicate.

I ran the two original test files with their direct dependencies in an isolated Debian 13 / Bash 5.2.37 / GNU grep 3.11 sandbox, as an unprivileged user. The retrieved source files were verified against their Git blob hashes. This was a focused source subset, not a complete checkout.

Test Before this PR PR head, stdin /dev/null PR head, open empty stdin pipe
omarchy-kernel-migration-test.sh exits 1 with /dev/null; blocks on an open pipe (terminated after 3 seconds) exit 0, 19 success records exit 0, 19 success records
kernel-headers-migration-test.sh fails at linux-omarchy gets its headers exit 0, 5 success records exit 0, 5 success records

38 further checks passed against the extracted pacman stubs and real package helpers, covering queries with/without --, exact present/absent package matching, multi-package helper calls, install operands, failed-install propagation, and idempotent installation. Stdin stayed open throughout those checks.

Non-blocking coverage suggestion: deleting only the new -S separator cleanup from the headers test's pacman stub still gives 5/5 success records, although the stub then records -- as an installed package and in the call log.

This assertion, placed immediately after the first bash -euo pipefail "$migration" >/dev/null inside the kernel loop, detects that regression:

  ! grep -Fxq -- "--" "$INSTALLED_PACKAGES" "$CALL_LOG" || fail "the operand separator is not recorded as a package"

I verified that it passes with this PR, and fails with not ok - the operand separator is not recorded as a package after removing only the install-separator cleanup. Both results hold with /dev/null and an open stdin pipe.

Scope: ./test/all and graphical/live-system tests were not run; a complete repository download was unavailable in that sandbox. No real packages were installed and no boot configuration was changed.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at a883efc. This fixes the bug, and nothing needs to change.

Reproduced on a disposable Omarchy worker. I ran both test files with stdin closed and with stdin held open, on quattro (821ae58) and on this head, both as-is and merged with current quattro:

quattro this PR
kernel-headers-migration-test.sh not ok - linux-omarchy gets its headers 5/5 ok
omarchy-kernel-migration-test.sh, stdin /dev/null exits 1 before its first assertion 19/19 ok
omarchy-kernel-migration-test.sh, stdin open hangs until killed 19/19 ok

Reverting either file on its own brings back that file's failure, so both changes are needed. ./test/cli stops at vscode generated theme references current theme file here and on unmodified quattro alike; #13065 fixes that, and this PR touches nothing it covers.

Second opinion: Codex Medium reviewed this diff. Like my own review, it found no defect: the shift arithmetic leaves the package at $1 in both -Q stubs, and the -S cleanup drops only the separator. Independence isn't guaranteed, since it can read this review's reasoning. Both of us read the suggestion above to assert that -- is never recorded as a package as optional extra coverage, not a blocker.

Related: #13365 fixes the same two stubs differently. It takes the last argument for -Q and drops every dash-prefixed argument for -S. Codex Medium was asked to compare them without being shown my answer. We both prefer this one: it uses the same -- handling as the fingerprint stubs, and #13365's last-argument lookup would miss a helper that put an extra operand ahead of the package. Both remain open for the maintainer to choose between.

This is now waiting on the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 4, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Rechecked at a883efc now that this conflicts with quattro. quattro has since fixed the same bug itself, so this pull request has nothing left to add and can be closed.

What changed on quattro. 0e7d6c2 (#14259) rewrote both pacman stubs this PR touches. The -Q stubs in kernel-headers-migration-test.sh and omarchy-kernel-migration-test.sh now read the package from $3 after a --, and the headers stub's -S branch shifts past -- before recording packages. The kernel test's expected install call already includes the separator, matching your change line for line. That commit is where the conflict comes from.

What I checked. I compared this branch with quattro (d9b970d) and traced what both tests run. The migrations only reach pacman through omarchy-pkg-present, omarchy-pkg-missing and omarchy-pkg-add, and every one of those calls passes --. The only thing this branch still does differently is accept calls without --, and nothing under test makes one. Outside the stubs, the two test files are identical on both branches. This was a source comparison. I ran nothing on a worker this time, since there is no fix left to verify.

Second opinion: Codex Medium traced the same call paths independently and reached the same conclusion: close as superseded. Independence isn't guaranteed, since it can read this review's reasoning.

#13365 changes the same two stubs, so the same commit covers it too.

Thanks for tracking this down. Your write-up of the hang is what the fix on quattro addresses. This now waits on the maintainer to close it.

@en3r0 en3r0 closed this Oct 10, 2026
@en3r0
en3r0 deleted the fix-kernel-migration-test-pacman-stub branch October 10, 2026 13:27
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.

4 participants