MycroftAI / mycroft-core

Mycroft Core, the Mycroft Artificial Intelligence platform.
https://mycroft.ai
Apache License 2.0
6.52k stars 1.27k forks source link

Multiple Instances of mycroft-config lead to settings saved to incorrect file #2818

Closed fnorbenden closed 1 month ago

fnorbenden commented 3 years ago

Enclosure: picroft Version: 20.8.0 Wake word: default

Expected behavior: mycroft-config cannot modify the default conf file

Observed behavior: multiple instances of mycroft-config result in erroneous writes, in particular to the default conf file.

I have been attempting to install a custom precise model and using mycroft-config to edit the configuration files for that purpose. I wanted to check the member variables for conf objects, so I opened the default configuration with

mycroft-config edit default

with the assumption that, as the message said, it was open only in view mode. I then opened a second instance of the configuration editor to copy things between with

mycroft-config edit user

This gave me a warning about a file lock, so I first exited the user conf instance with CTL-X, then exited the default conf instance with CTL-X. Mycroft restarted and I got this:

(.venv) pi@picroft:~ $ mycroft-config edit default The default config shouldn't be changed, opening in View mode Saving... Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pi/mycroft-core/mycroft/messagebus/send.py", line 56, in main() File "/home/pi/mycroft-core/mycroft/messagebus/send.py", line 51, in main send(message_to_send, data_to_send) File "/home/pi/mycroft-core/mycroft/messagebus/send_func.py", line 41, in send config.get("host"), AttributeError: 'NoneType' object has no attribute 'get'

I checked in /home/pi/mycroft-core/mycroft/configuration/mycroft.conf for the default conf, which had been completely overridden by the contents of the user conf:

(.venv) pi@picroft:~ $ cat /home/pi/mycroft-core/mycroft/configuration/mycroft.conf { "max_allowed_core_version": 20.8 }

krisgesling commented 3 years ago

Hey there, thanks for flagging this. I hadn't run into it.

It's not something the internal team will prioritize immediately but should be fixed at some point. If anyone in the community is interested in helping out, this would be a good one to tackle.

forslund commented 1 month ago

Closing Issue since we're archiving the repo