Fix unbound XKBLAYOUT under set -u in the keyboard-layout migration - #6539
Open
acidkill wants to merge 1 commit into
Open
Fix unbound XKBLAYOUT under set -u in the keyboard-layout migration#6539acidkill wants to merge 1 commit into
acidkill wants to merge 1 commit into
Conversation
/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.
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents keyboard-layout migration failures when XKBLAYOUT is unset under strict shell execution.
Changes:
- Safely defaults an unset
XKBLAYOUTto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/etc/vconsole.confonly guaranteesKEYMAP--XKBLAYOUTis written bysome installers but isn't required, and on this machine's stock install it
isn't present at all.
migrations/1784476564.shreferenced it directly, andomarchy-migrateruns every migration underset -euo pipefail, so theunset 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
XKBLAYOUTwith a default-empty expansion first, then apply theexisting 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
/etc/vconsole.confcontaining only
FONT/KEYMAP(noXKBLAYOUT) crashes the oldexpansion under
set -u; the new one returns an empty layout safelytest/shell.d/migrate-wrapper-test.shpasses