Skip to content

Certain config files will crash kitty --debug-config #695

Closed
@Luflosi

Description

@Luflosi

When executing kitty --debug-config, I noticed, that my config file causes it to crash when trying to print the shortcuts. I narrowed it down to a single line in my config file. The file in /tmp/kitty.conf contains the following line: map kitty_mod+equal change_font_size all +0.5. Executing kitty --config /tmp/kitty.conf --debug-config will give the following output:

kitty 0.11.1 (9277b80) created by Kovid Goyal
Darwin hostname_was_here 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
ProductName: Mac OS X ProductVersion: 10.13.5 BuildVersion: 17F77
Loaded config files: /tmp/kitty.conf

Config options different from defaults:
Changed shortcuts:
[181 13:17:25.892424] Traceback (most recent call last):
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/main.py", line 249, in main
_main()
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/main.py", line 222, in _main
create_opts(args, debug_config=True)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 704, in create_opts
compare_opts(opts)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 681, in compare_opts
compare_keymaps(final, initial)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 652, in compare_keymaps
print_shortcut_changes(final, 'Changed shortcuts:', changed)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 643, in print_shortcut_changes
print_shortcut(k, defns[k])
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 627, in print_shortcut
mods, key = key
ValueError: too many values to unpack (expected 2)

When experimenting with this line in the config file, I changed the line to map foo+equal change_font_size all +0.5, which results in a different crash:

kitty 0.11.1 (9277b80) created by Kovid Goyal
Darwin hostname_was_here 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
ProductName: Mac OS X ProductVersion: 10.13.5 BuildVersion: 17F77
Loaded config files: /tmp/kitty.conf
[181 13:27:44.731404] Shortcut: foo+equal has unknown modifier, ignoring
[181 13:27:44.733389] Traceback (most recent call last):
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/main.py", line 249, in main
_main()
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/main.py", line 222, in _main
create_opts(args, debug_config=True)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/cli.py", line 702, in create_opts
opts = load_config(*config, overrides=overrides)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/config.py", line 443, in load_config
opts = _load_config(Options, defaults, parse_config, merge_configs, *paths, overrides=overrides)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/conf/utils.py", line 171, in load_config
vals = parse_config(f)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/config.py", line 276, in parse_config
check_keys=check_keys
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/conf/utils.py", line 103, in parse_config_base
_parse(lines, type_map, special_handling, ans, all_keys)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/conf/utils.py", line 96, in _parse
parse_line(line, type_map, special_handling, ans, all_keys, base_path_for_includes)
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/conf/utils.py", line 65, in parse_line
if special_handling(key, val, ans):
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/config.py", line 250, in special_handling
parse_key(val, ans['key_definitions'])
File "/Applications/kitty.app/Contents/Frameworks/kitty/kitty/config.py", line 177, in parse_key
mods, is_native, key = parse_shortcut(sc)
ValueError: not enough values to unpack (expected 3, got 2)

Changing the keybinding or the font size to be different than the default will result in one of those two crashes.

I hope, the two outputs contain enough information about my system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions