Repository navigation
Conversation
The fcitx5 package's activation file spawns a bare fcitx5 whenever a client asks for org.fcitx.Fcitx5 while the unit is between restarts. The unit's instance then exits 0 on every start and Restart=always loops it forever. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Automated AI review
Outcome: The new migration can abort Migration fails when fcitx5 is not runningMigrations run under Suggested change: add Reproducer (fails at 722c006)Save as #!/bin/bash
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"
migration="$ROOT/migrations/1790604026.sh"
test_dir=$(mktemp -d)
trap 'rm -rf "$test_dir"' EXIT
stub_bin="$test_dir/bin"
mkdir -p "$stub_bin"
# busctl answers `status` the way the real one does: a PID= line when someone
# owns the name, or exit 1 when nobody does. ReloadConfig just succeeds.
cat >"$stub_bin/busctl" <<'SH'
#!/bin/bash
if [[ $* == *" status org.fcitx.Fcitx5" ]]; then
if [[ -z ${TEST_OWNER_PID:-} ]]; then
echo "Failed to get credentials: No such device or address" >&2
exit 1
fi
printf 'PID=%s\nPPID=1\nUID=1000\n' "$TEST_OWNER_PID"
fi
SH
# A graphical session is running; MainPID is whatever the case says.
cat >"$stub_bin/systemctl" <<'SH'
#!/bin/bash
case "$*" in
"--user is-active --quiet graphical-session.target") exit 0 ;;
"--user show --property MainPID --value omarchy-fcitx5.service") echo "${TEST_MAIN_PID:-0}" ;;
*) exit 1 ;;
esac
SH
cat >"$stub_bin/omarchy-restart-xcompose" <<'SH'
#!/bin/bash
echo restart >>"$TEST_CALLS"
SH
chmod +x "$stub_bin"/*
calls="$test_dir/calls"
# Same shell options omarchy-migrate runs every migration with.
run_migration() {
rm -f "$calls"
TEST_CALLS="$calls" PATH="$stub_bin:$PATH" bash -euo pipefail "$migration" >/dev/null 2>&1
}
TEST_OWNER_PID=4242 TEST_MAIN_PID=4242 run_migration ||
fail "migration succeeds when the unit owns the bus name"
[[ ! -e $calls ]] || fail "migration restarts a healthy unit"
pass "migration leaves a healthy unit alone"
TEST_OWNER_PID=5151 TEST_MAIN_PID=0 run_migration ||
fail "migration succeeds when a D-Bus activated fcitx5 owns the bus name"
[[ -e $calls ]] || fail "migration hands a D-Bus activated fcitx5 back to the unit"
pass "migration hands a D-Bus activated fcitx5 back to the unit"
# Nobody owns org.fcitx.Fcitx5: the user stopped or disabled the unit, removed
# fcitx5, or it is between restarts. busctl status exits 1 here, and under
# pipefail that fails the assignment, errexit stops the migration, and
# omarchy-migrate stops the queue (and omarchy update with it).
TEST_MAIN_PID=0 run_migration ||
fail "migration fails when nothing owns org.fcitx.Fcitx5"
[[ ! -e $calls ]] || fail "migration restarts fcitx5 when nothing owns its bus name"
pass "migration leaves a session without fcitx5 alone"Actual output at 722c006 (exit status 1): Actual output after changing only line 11 of - owner=$(busctl --user status org.fcitx.Fcitx5 2>/dev/null | sed -n 's/^PID=//p')
+ owner=$(busctl --user status org.fcitx.Fcitx5 2>/dev/null | sed -n 's/^PID=//p') || trueThe stubbed and exited 1 with an empty stderr. It wrote no marker for 1790604026 and did not run the later migration. omarchy-pkgs#704 packaging gaps
Suggested change: guard that line with Reproducer (package() run locally, not in CI)omarchy-pkgs#704 (head 748f8210) adds an unconditional install of Harness: source the PKGBUILD, copy an omarchy checkout to run_package() {
local label=$1 pkgbuild=$2 tree=$3 carch=${4:-x86_64}
local work=/tmp/pkg-$label
mkdir -p "$work/src" "$work/pkg"
cp -a "$tree" "$work/src/omarchy"
(
cd "$work"
export PATH="$stub:/usr/bin:/bin" CARCH=$carch srcdir="$work/src" pkgdir="$work/pkg"
source "$pkgbuild"
shopt -o -s errexit errtrace
trap 'echo "ERR: package() stopped at: $BASH_COMMAND" >&2' ERR
package
)
}Actual results:
stderr of the failing run: Files that are newer than the release pin already use a guard in the release PKGBUILD, for example lines 237-240 of #704's # Older release pins still configure locate through install/config/locate.sh.
if [[ -f default/systemd/system/plocate-updatedb.service.d/10-omarchy.conf ]]; then
install -Dm644 default/systemd/system/plocate-updatedb.service.d/10-omarchy.conf "$pkgdir/usr/lib/systemd/system/plocate-updatedb.service.d/10-omarchy.conf"
fi
DetailsVerified
Optional notes
Related PR: open #10578 changes the adjacent Review informationTest scope: Source and sandbox tests at 722c006; loop not re-run in a real session. AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
busctl status exits 1 when no process owns org.fcitx.Fcitx5. Under the bash -euo pipefail that omarchy-migrate runs migrations with, the owner lookup then killed the migration and blocked every later one. Treat a missing owner as empty and leave the session alone. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A user who disabled or masked omarchy-fcitx5.service and runs fcitx5 their own way also has a bus owner that is not the unit's MainPID. The migration took that for the activation loop and called omarchy-restart-xcompose, which killed their fcitx5; with the unit masked, the start that follows fails and the migration aborts the queue. Only hand the name back when the unit is enabled, which is the only state the loop happens in. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
| cat >"$stub_bin/busctl" <<'SH' | ||
| #!/bin/bash | ||
| case "$2" in | ||
| call) exit 0 ;; |
There was a problem hiding this comment.
The busctl stub accepts any call, and the test never checks that ReloadConfig was requested. Removing or misspelling that call would leave every case passing, even though the current session would keep using the old activation file. Record the call arguments and require the expected reload before checking restart behavior.
|
Reviewed and verified on a disposable worker built from the Omarchy ISO (fcitx5 5.1.22, dbus-broker 37, systemd 261.2), in a live Hyprland session. Reviewed by Claude Opus 5.5 and Codex Medium. The bug is real and this fixes it. With the unit stopped, a D-Bus call to Pushed d1ea3f5: the migration only hands the name back when Tests on the worker, at d1ea3f5: Second opinion: Codex Medium reviewed it twice. The first round found the defect above. The second round, on d1ea3f5, found nothing more. It checked that the guard holds for each state the unit can be in, including the hand-made Waiting on omacom/omarchy-pkgs#704, which installs the file, so this can't land before it. As it stands, #704 would also break the release build: |
|
Thank you for this. What it does is now on This is now on This was checked against |
The fcitx5 package ships
/usr/share/dbus-1/services/org.fcitx.Fcitx5.service. When any client asks fororg.fcitx.Fcitx5whileomarchy-fcitx5.serviceis between restarts, dbus-broker spawns a bare fcitx5 outside the unit. The unit's instance then finds the name taken, exits 0, andRestart=alwaysloops it every ~2s for the rest of the session.This ships an activation file at
/usr/local/share/dbus-1/services/org.fcitx.Fcitx5.servicewithSystemdService=omarchy-fcitx5.service./usr/local/shareprecedes/usr/sharein the session'sXDG_DATA_DIRS(Omarchy already shipswayland-sessionsthere), so activation starts the unit instead of a second fcitx5. A migration reloads the bus config and hands a session that is already looping back to the unit; a healthy unit is left alone.Needs the matching omarchy-settings PKGBUILD change: omacom/omarchy-pkgs#704
Testing
Fresh Omarchy 4.0.4 install, fcitx5 5.1.22, dbus-broker 37. Each case stops the unit, runs
fcitx5-remote -n, starts the unit, waits 30s, then requires one fcitx5 owned by the unit withNRestartsno longer climbing:Migration: on a session looping at 3 restarts it restored a single unit-owned fcitx5 with 0 restarts; rerun on the healthy unit it left the same MainPID running.
systemd-test.sh,config-test.sh,migrate-scope-test.sh,migrate-wrapper-test.sh,unowned-system-paths-test.shpass.Not covered
/usr/bin/fcitx5(Keep the fcitx5 unit inert when fcitx5 isn't installed #11694).fcitx5 -rby hand still displaces the unit.Refs #7461
🤖 Generated with Claude Code