Menu

#155 Keybindings file overwritten on load error

Git
open
nobody
None
5
2026-03-05
2026-03-05
FeRD
No

#TIL that if you have a syntax error in your $HOME/.config/mcomix/keybindings.conf file, it will fail to load (as expected), and MComix will log an error (also as expected) on startup, something like:

10:42:33 [MainThread] ERROR: Couldn't load keybindings: Illegal trailing comma before end of array: line 121 column 17 (char 1779)

It will then operate with the default keybindings. (Again, as expected.)

What wasn't expected is that, if you then quit MComix, it will save back the current (read: defaulted) keybindings to that same file path that it didn't load them from, wiping out your invalid-syntax configuration and implicitly resetting all keybindings to defaults permanently.

Seems like, if a file $HOME/.config/mcomix/keybindings.conf exists but the keybindings weren't loaded from it, then MComix should do one of these things with it:

  1. Don't save keybindings to that file on exit, since they weren't loaded from it.
  2. Only save keybindings to that file on exit if the bindings have been modified using the preferences. (Otherwise, MComix is only saving the defaults to the file anyway, and there's little point to writing a config file that contains only the default bindings. They're the defaults, no config file is necessary to get those.)
  3. Or, the invalid $HOME/.config/mcomix/keybindings.conf file should be moved out of the way when it can't be read (renamed to $HOME/.config/mcomix/keybindings.conf.bad,, perhaps?), rather than automatically overwriting it.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB