linuxmint / linuxmint/cinnamon
cinnamon-settings keyboard crashes while parsing json
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 915
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 3
Description
Distribution
Archlinux latest
Package version
cinnamon 6.6.8
Graphics hardware in use
Radeon 780M
Frequency
Always
Bug description
cinnamon-settings keyboard seems to parse .json files in various paths to scrape relevant settings like shortcuts from shortcuts etc.
If found json-files do not match the expected pattern or have syntax errors cinnamon-settings keyboard will crash and will only be accessible, after removing / fixing the offending json config file.
This issue is exacerbated by the fact, that there is no hint to the json file that caused the crash and the search can become quite bothersome if multiple spices are installed.
Currently at least one applet resulting in this behavior is part of cinnamon (see step to reproduce for details)
Traceback
Traceback (most recent call last):
File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 825, in <module>
window = MainWindow(args)
File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 334, in __init__
if self.load_sidepage_as_standalone(parsed_args):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 426, in load_sidepage_as_standalone
self.go_to_sidepage(sp_data.sp, user_action=False)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 187, in go_to_sidepage
sidePage.build()
~~~~~~~~~~~~~~^^
File "/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py", line 217, in build
self.module.on_module_selected()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py", line 268, in on_module_selected
self.kb_table = KeybindingTable.get_default()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/share/cinnamon/cinnamon-settings/bin/KeybindingTable.py", line 976, in get_default
instance = KeybindingTable()
File "/usr/share/cinnamon/cinnamon-settings/bin/KeybindingTable.py", line 501, in __init__
self._load_spice_store()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/share/cinnamon/cinnamon-settings/bin/KeybindingTable.py", line 656, in _load_spice_store
for key, val in _config.items():
^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'items'
Steps to reproduce
- run
cinnamon-settings applets - install applet
ShellTools - add
ShellToolsapplet to panel (this step might not be neccessary) - run
cinnamon-setting keyboard
result: cinnamon-settings keyboard will crash when trying to parse tools.json in ShellTools applet path.
Expected behavior
cinnamon-settings keyboard should fail gracefully if a .json from applets etc has syntax error or does not match the expected pattern.
Ideally users should be informed about the offending json file
Additional information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with cinnamon-settings/bin/KeybindingTable.py, especially KeybindingTable._load_spice_store(), which is shown in the traceback while reading applet JSON files. Reproduce with the ShellTools applet and its tools.json, then verify that invalid JSON or an unexpected structure no longer crashes cinnamon-settings keyboard and that the offending file can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100