Skip to content

Fix unbound XKBLAYOUT under set -u in the keyboard-layout migration - #6539

Open
acidkill wants to merge 1 commit into
basecamp:quattrofrom
acidkill:fix/migrate-xkblayout-unset
Open

Fix unbound XKBLAYOUT under set -u in the keyboard-layout migration#6539
acidkill wants to merge 1 commit into
basecamp:quattrofrom
acidkill:fix/migrate-xkblayout-unset

Conversation

@acidkill

@acidkill acidkill commented Aug 3, 2026

Copy link
Copy Markdown

Summary

/etc/vconsole.conf only guarantees KEYMAP -- XKBLAYOUT is written by
some installers but isn't required, and on this machine's stock install it
isn't present at all. migrations/1784476564.sh referenced it directly, and
omarchy-migrate runs every migration under set -euo pipefail, so the
unset variable aborted the whole migration run instead of just skipping a
layout this particular migration doesn't care about.

Unrelated to the idle-service work in a separate PR from the same session --
kept as its own commit since it touches a different part of the codebase for
a different reason.

Fix

Read XKBLAYOUT with a default-empty expansion first, then apply the
existing comma-strip as a second step, so an unset variable and a set one
with a trailing keymap variant are both handled explicitly instead of
folding into one expansion that only covered the latter.

Test plan

  • Reproduced directly: sourcing a synthetic /etc/vconsole.conf
    containing only FONT/KEYMAP (no XKBLAYOUT) crashes the old
    expansion under set -u; the new one returns an empty layout safely
  • test/shell.d/migrate-wrapper-test.sh passes

/etc/vconsole.conf only guarantees KEYMAP -- XKBLAYOUT is written by some
installers but not required, and vconsole.conf on a stock install may not
define it at all. omarchy-migrate runs every migration with set -euo
pipefail, so referencing the unset variable directly aborted the migration
run instead of just skipping a layout this migration doesn't care about.

Read it with a default-empty expansion first, then apply the existing
comma-strip separately -- keeps both failure modes (unset, and set with a
trailing keymap variant) handled explicitly instead of folding them into one
expansion that only covers one of the two.
Copilot AI review requested due to automatic review settings August 3, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents keyboard-layout migration failures when XKBLAYOUT is unset under strict shell execution.

Changes:

  • Safely defaults an unset XKBLAYOUT to empty.
  • Separately strips trailing layout variants.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants