Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault without debug message when XKB_DEFAULT_LAYOUT is not correct #7789

Closed
louwenus opened this issue Oct 22, 2023 · 3 comments · Fixed by #8037
Closed

Segfault without debug message when XKB_DEFAULT_LAYOUT is not correct #7789

louwenus opened this issue Oct 22, 2023 · 3 comments · Fixed by #8037
Labels
bug Not working as intended

Comments

@louwenus
Copy link

Please fill out the following:

  • Sway Version:
    sway version 1.9-dev-4326a26a (Oct 22 2023, branch 'makepkg')
    (also reproducible with latest arch package)

  • Debug Log:
    debug_log

  • Configuration File:
    Default (/etc/sway/config)

  • Stack Trace:

    #0  0x00007ff58eac8b60 in xkb_keymap_ref () at /usr/lib/libxkbcommon.so.0
    #1  0x00007ff58eace3c5 in xkb_state_new () at /usr/lib/libxkbcommon.so.0
    #2  0x0000560db9ad3e0e in  ()
    #3  0x0000560db9ac9549 in  ()
    #4  0x00007ff58e8b0cd0 in  () at /usr/lib/libc.so.6
    #5  0x00007ff58e8b0d8a in __libc_start_main () at /usr/lib/libc.so.6
    #6  0x0000560db9aca0f5 in  ()
    
  • Description:
    Set XKB_DEFAULT_LAYOUT to a layout you do not have (fr-latin9 in my case)
    Run sway
    Sway segfault (SIGSEGV and return 139)

    I would have expected sway to launch anyway, using default keyboard and/or output a helpful message about what went wrong

Upon trying to understand this issue, I used sway -Vd in order to understand what was happening:
When doing so from a terminal emulator (eg, a started sway or X session), we get full debug (just like when using sway -d 2>sway.log)
However, when the command is issued directly from TTY, a lot of output is missing (including the obvious last lines pointing at what the error was), only 26 lines were printed, the last one being 00:00:00.003 [DEBUG] [sway/server.c:89] Initializing Wayland server

This behavior is quite confusing, and do not seem documented (neither in the wiki nor the man pages), is it a bug?

NB: This bug seem to involve wlroots/libxkbcommon, and I did not know to who I should report it. If you think this bug report should be redirected to one or the other, please feel free to redirect me there.

@louwenus louwenus added the bug Not working as intended label Oct 22, 2023
@abextm
Copy link

abextm commented Mar 5, 2024

Here is a symbolicated stack from sway 1.9 release on arch

#0  xkb_keymap_ref (keymap=0x0) at ../libxkbcommon/src/keymap.c:61
#1  0x00007a8bc53913c5 in xkb_state_new (keymap=keymap@entry=0x0) at ../libxkbcommon/src/state.c:594
#2  0x00006514808d1dfe in keysym_translation_state_create (rules=...) at ../sway-1.9/sway/config.c:47
#3  config_defaults (config=<optimized out>) at ../sway-1.9/sway/config.c:340
#4  load_main_config (file=<optimized out>, is_active=false, validating=false)
    at ../sway-1.9/sway/config.c:465
#5  0x00006514808c7572 in main (argc=<optimized out>, argv=0x7ffda0830cc8)
    at ../sway-1.9/sway/main.c:393

and some log lines for googlability

xkbcommon: DEBUG: Compiling xkb_symbols "(unnamed)"
xkbcommon: ERROR: [XKB-338] Couldn't find file "symbols/dvorak" in include paths
xkbcommon: ERROR: [XKB-338] 1 include paths searched:
xkbcommon: ERROR: [XKB-338]     /usr/share/X11/xkb
xkbcommon: ERROR: [XKB-338] 3 include paths could not be added:
xkbcommon: ERROR: [XKB-338]     /home/abex/.config/xkb
xkbcommon: ERROR: [XKB-338]     /home/abex/.xkb
xkbcommon: ERROR: [XKB-338]     /etc/xkb
xkbcommon: ERROR: [XKB-769] Abandoning symbols file "(unnamed)"
xkbcommon: ERROR: Failed to compile xkb_symbols
xkbcommon: ERROR: Failed to compile keymap

@emersion
Copy link
Member

emersion commented Mar 5, 2024

when the command is issued directly from TTY, a lot of output is missing (including the obvious last lines pointing at what the error was), only 26 lines were printed, the last one being 00:00:00.003 [DEBUG] [sway/server.c:89] Initializing Wayland server

It's the kernel console behavior, out of Sway's control.

Nevertheless, crashing is always a bug.

emersion added a commit to emersion/sway that referenced this issue Mar 5, 2024
If we can't create the XKB keymap used for keysym translation,
gracefully error out instead of crashing. This can happen if the
XKB_DEFAULT_LAYOUT is set to an invalid value, for instance.

Closes: swaywm#7789
@emersion
Copy link
Member

emersion commented Mar 5, 2024

#8037 should help.

bl4ckb0ne pushed a commit that referenced this issue Mar 6, 2024
If we can't create the XKB keymap used for keysym translation,
gracefully error out instead of crashing. This can happen if the
XKB_DEFAULT_LAYOUT is set to an invalid value, for instance.

Closes: #7789
frosklis pushed a commit to frosklis/sway-frosklis that referenced this issue Mar 31, 2024
If we can't create the XKB keymap used for keysym translation,
gracefully error out instead of crashing. This can happen if the
XKB_DEFAULT_LAYOUT is set to an invalid value, for instance.

Closes: swaywm#7789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

Successfully merging a pull request may close this issue.

3 participants