Incorrect xkbregistry configuration crashes Shell
I tried https://who-t.blogspot.com/2020/09/user-specific-xkb-configuration-putting.html in conjunction with the recent changes in libgnome-desktop, but wrote the xkb syntax to the wrong filename. This caused Shell to crash on selecting my new layout, and then again on re-login, which would be difficult to recover from if I hadn't been able to fix the syntax error easily.
The crash looks like it's caused by ref'ing a NULL xkb keymap object:
Stack trace of thread 4278:
#0 0x00007fc83c20b9e0 xkb_keymap_ref (libxkbcommon.so.0 + 0x1d9e0)
#1 0x00007fc83eb86b62 n/a (libmutter-7.so.0 + 0x147b62)
#2 0x00007fc83eb98db8 n/a (libmutter-7.so.0 + 0x159db8)
#3 0x00007fc83eb7c7bc n/a (libmutter-7.so.0 + 0x13d7bc)
I would expect mutter/Shell to print a warning and fall back to an en_US layout, or switch to one of my other configured layouts, or something along those lines.
The broken setup that reproduced this, caused by adapting Peter Hutterer's blog post when insufficiently caffeinated:
cd ${XDG_CONFIG_HOME:-~/.config}
mkdir -p xkb/compat
mkdir -p xkb/keycodes
mkdir -p xkb/rules
mkdir -p xkb/symbols
cat > xkb/symbols/evdev <<'EOF'
! option = symbols
custom:foo = +custom(foo)
! include %S/evdev
EOF
cat > xkb/rules/evdev.xml <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
<xkbConfigRegistry version="1.1">
<layoutList>
<layout>
<configItem>
<name>gb</name>
</configItem>
<variantList>
<variant>
<configItem>
<name>smcv</name>
<shortDescription>smcv</shortDescription>
<description>English (smcv)</description>
</configItem>
</variant>
</variantList>
</layout>
</layoutList>
<optionList>
<group allowMultipleSelection="true">
<configItem>
<name>custom</name>
<description>custom options</description>
</configItem>
<option>
<configItem>
<name>custom:foo</name>
<description>Return to normal Shift+Alt+3</description>
</configItem>
</option>
</group>
</optionList>
</xkbConfigRegistry>
EOF
cat > xkb/symbols/custom <<'EOF'
partial alphanumeric_keys modifier_keys
xkb_symbols "foo" {
key <AE03> { [ 3, sterling, threesuperior, sterling ] };
};
EOF
cat > xkb/symbols/us <<'EOF'
partial alphanumeric_keys modifier_keys
xkb_symbols "smcv" {
name[Group1]= "smcv (UK)";
include "gb(basic)"
key <AE03> { [ 3, sterling, threesuperior, onethird ] };
};
EOF
(and then choose English (smcv)
in gnome-control-center).
The fixed version: rename xkb/symbols/us
to xkb/symbols/gb
.