diff --git a/src/bin/cli/src/main.cpp b/src/bin/cli/src/main.cpp index 961aedc52..0973d7243 100644 --- a/src/bin/cli/src/main.cpp +++ b/src/bin/cli/src/main.cpp @@ -22,7 +22,8 @@ namespace { void apply_core_configuration_function(std::function)> function) { auto wait = pqrs::make_thread_wait(); krbn::configuration_monitor monitor(krbn::constants::get_user_core_configuration_file_path(), - geteuid()); + geteuid(), + krbn::core_configuration::error_handling::loose); monitor.core_configuration_updated.connect([wait, function](auto&& weak_core_configuration) { if (auto core_configuration = weak_core_configuration.lock()) { diff --git a/src/core/console_user_server/include/console_user_server/components_manager.hpp b/src/core/console_user_server/include/console_user_server/components_manager.hpp index cce282eb9..119705bce 100644 --- a/src/core/console_user_server/include/console_user_server/components_manager.hpp +++ b/src/core/console_user_server/include/console_user_server/components_manager.hpp @@ -183,7 +183,8 @@ class components_manager final : public pqrs::dispatcher::extra::dispatcher_clie void start_child_components(void) { configuration_monitor_ = std::make_shared(constants::get_user_core_configuration_file_path(), - geteuid()); + geteuid(), + krbn::core_configuration::error_handling::loose); configuration_monitor_->core_configuration_updated.connect([](auto&& weak_core_configuration) { if (auto c = weak_core_configuration.lock()) { // diff --git a/src/core/grabber/include/grabber/device_grabber.hpp b/src/core/grabber/include/grabber/device_grabber.hpp index 95de3fda7..4ed957796 100644 --- a/src/core/grabber/include/grabber/device_grabber.hpp +++ b/src/core/grabber/include/grabber/device_grabber.hpp @@ -447,7 +447,8 @@ class device_grabber final : public pqrs::dispatcher::extra::dispatcher_client { event_tap_monitor_->async_start(); configuration_monitor_ = std::make_unique(user_core_configuration_file_path, - expected_user_core_configuration_file_owner); + expected_user_core_configuration_file_owner, + krbn::core_configuration::error_handling::loose); configuration_monitor_->core_configuration_updated.connect([this](auto&& weak_core_configuration) { if (auto core_configuration = weak_core_configuration.lock()) { diff --git a/src/lib/libkrbn/include/libkrbn/impl/libkrbn_configuration_monitor.hpp b/src/lib/libkrbn/include/libkrbn/impl/libkrbn_configuration_monitor.hpp index c57f0297e..7d485ffee 100644 --- a/src/lib/libkrbn/include/libkrbn/impl/libkrbn_configuration_monitor.hpp +++ b/src/lib/libkrbn/include/libkrbn/impl/libkrbn_configuration_monitor.hpp @@ -12,7 +12,8 @@ class libkrbn_configuration_monitor final : public pqrs::dispatcher::extra::disp : dispatcher_client() { monitor_ = std::make_unique( krbn::constants::get_user_core_configuration_file_path(), - geteuid()); + geteuid(), + krbn::core_configuration::error_handling::loose); auto wait = pqrs::make_thread_wait(); diff --git a/src/lib/libkrbn/src/libkrbn_configuration.cpp b/src/lib/libkrbn/src/libkrbn_configuration.cpp index 6dbe67a80..958d75213 100644 --- a/src/lib/libkrbn/src/libkrbn_configuration.cpp +++ b/src/lib/libkrbn/src/libkrbn_configuration.cpp @@ -141,7 +141,7 @@ bool libkrbn_core_configuration_get_machine_specific_enable_multitouch_extension if (auto c = get_current_core_configuration()) { return c->get_machine_specific().get_entry().get_enable_multitouch_extension(); } - return krbn::core_configuration::details::machine_specific::entry::enable_multitouch_extension_default_value; + return false; } void libkrbn_core_configuration_set_machine_specific_enable_multitouch_extension(bool value) { diff --git a/src/share/core_configuration/configuration_json_helper.hpp b/src/share/core_configuration/configuration_json_helper.hpp index 4ff6c3542..f0ff13dd1 100644 --- a/src/share/core_configuration/configuration_json_helper.hpp +++ b/src/share/core_configuration/configuration_json_helper.hpp @@ -55,9 +55,11 @@ class value_t final : public base_t { } value_ = it->template get(); - } catch (...) { + } catch (std::exception& e) { if (error_handling == error_handling::strict) { throw; + } else { + logger::get_logger()->error(e.what()); } } } diff --git a/src/share/core_configuration/core_configuration.hpp b/src/share/core_configuration/core_configuration.hpp index c4343ad33..46b815280 100644 --- a/src/share/core_configuration/core_configuration.hpp +++ b/src/share/core_configuration/core_configuration.hpp @@ -32,8 +32,10 @@ class core_configuration final { public: core_configuration(const core_configuration&) = delete; - core_configuration(error_handling error_handling) - : core_configuration("", 0, error_handling) { + core_configuration(void) + : core_configuration("", + 0, + krbn::core_configuration::error_handling::loose) { } core_configuration(const std::string& file_path, diff --git a/src/share/monitor/configuration_monitor.hpp b/src/share/monitor/configuration_monitor.hpp index 2ede2912c..731c62be0 100644 --- a/src/share/monitor/configuration_monitor.hpp +++ b/src/share/monitor/configuration_monitor.hpp @@ -19,6 +19,7 @@ class configuration_monitor final : public pqrs::dispatcher::extra::dispatcher_c configuration_monitor(const std::string& user_core_configuration_file_path, uid_t expected_user_core_configuration_file_owner, + core_configuration::error_handling error_handling, const std::string& system_core_configuration_file_path = constants::get_system_core_configuration_file_path()) : dispatcher_client() { std::vector targets = { user_core_configuration_file_path, @@ -31,6 +32,7 @@ class configuration_monitor final : public pqrs::dispatcher::extra::dispatcher_c file_monitor_->file_changed.connect([this, user_core_configuration_file_path, expected_user_core_configuration_file_owner, + error_handling, system_core_configuration_file_path](auto&& changed_file_path, auto&& changed_file_body) { auto file_path = changed_file_path; @@ -61,7 +63,8 @@ class configuration_monitor final : public pqrs::dispatcher::extra::dispatcher_c } auto c = std::make_shared(file_path, - expected_user_core_configuration_file_owner); + expected_user_core_configuration_file_owner, + error_handling); if (core_configuration_ && !c->is_loaded()) { return; diff --git a/tests/Makefile b/tests/Makefile index 3626f929f..63f74c279 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,6 +1,6 @@ all: bash scripts/check-cmakelists.sh - @for d in `find lib src -type d | sort`; do \ + @for d in `find src -type d | sort`; do \ if [ -f "$$d/Makefile" ]; then \ echo "[Test] $$d"; \ make -C $$d || exit 1; \ @@ -8,7 +8,7 @@ all: done clean: - @for d in `find lib src -type d | sort`; do \ + @for d in `find src -type d | sort`; do \ if [ -f "$$d/Makefile" ]; then \ make -C $$d clean; \ fi; \ diff --git a/tests/src/configuration_monitor/src/test.cpp b/tests/src/configuration_monitor/src/test.cpp index 1a84b8926..56f2c24c0 100644 --- a/tests/src/configuration_monitor/src/test.cpp +++ b/tests/src/configuration_monitor/src/test.cpp @@ -8,6 +8,7 @@ class test_configuration_monitor final { test_configuration_monitor(void) : count_(0) { configuration_monitor_ = std::make_unique("target/user.json", geteuid(), + krbn::core_configuration::error_handling::loose, "target/system.json"); configuration_monitor_->core_configuration_updated.connect([this](auto&& weak_core_configuration) { diff --git a/tests/src/manipulator/src/manipulator_factory_test.hpp b/tests/src/manipulator/src/manipulator_factory_test.hpp index 64f2cc81e..823d10519 100644 --- a/tests/src/manipulator/src/manipulator_factory_test.hpp +++ b/tests/src/manipulator/src/manipulator_factory_test.hpp @@ -99,7 +99,8 @@ void run_manipulator_factory_test(void) { }, }}, }); - krbn::core_configuration::details::device device(json); + krbn::core_configuration::details::device device(json, + krbn::core_configuration::error_handling::loose); auto device_id_1234_5678_keyboard = manipulator_conditions_helper.prepare_device( pqrs::hid::vendor_id::value_t(1234), // vendor_id diff --git a/tests/src/manipulator_conditions/src/manipulator_conditions_test.hpp b/tests/src/manipulator_conditions/src/manipulator_conditions_test.hpp index 6a4b49656..582afec78 100644 --- a/tests/src/manipulator_conditions/src/manipulator_conditions_test.hpp +++ b/tests/src/manipulator_conditions/src/manipulator_conditions_test.hpp @@ -126,7 +126,9 @@ void run_manipulator_conditions_test(void) { })); manipulator_environment.set_system_preferences_properties(system_preferences_properties); - auto core_configuration = std::make_shared("json/core_configuration.json", geteuid()); + auto core_configuration = std::make_shared("json/core_configuration.json", + geteuid(), + krbn::core_configuration::error_handling::loose); manipulator_environment.set_core_configuration(core_configuration); krbn::async_file_writer::wait(); @@ -348,7 +350,9 @@ void run_manipulator_conditions_test(void) { })); manipulator_environment.set_system_preferences_properties(system_preferences_properties); - auto core_configuration = std::make_shared("json/core_configuration.json", geteuid()); + auto core_configuration = std::make_shared("json/core_configuration.json", + geteuid(), + krbn::core_configuration::error_handling::loose); manipulator_environment.set_core_configuration(core_configuration); {