vsomeip
vsomeip copied to clipboard
VSOMEIP_MANDATORY_CONFIGURATION_FILES works incorrectly
According to the documentation:
VSOMEIP_MANDATORY_CONFIGURATION_FILES: vsomeip allows to specify mandatory configuration files to speed-up application startup. While mandatory configuration files are read by all applications, all other configuration files are only read by the application that is responsible for connections to external devices. If this configuration variable is not set, the default mandatory files vsomeip_std.json, vsomeip_app.json and vsomeip_plc.json are used.
My understanding is if I define VSOMEIP_MANDATORY_CONFIGURATION_FILES=service.json,common.json then only service.json and common.json are read and parsed.
Currently if there are the following files in the configuration folder: main_service.json other_service.json service.json common.json then all of them will be read and parsed.
This is caused by implementation in configuration_impl.cpp:
bool configuration_impl::is_mandatory(const std::string &_name) const {
std::set<std::string> its_candidates;
for (const auto& m : mandatory_) {
if (m.size() <= _name.size()) { /// <===== HERE
its_candidates.insert(m);
}
}
if (its_candidates.empty())
return false;
for (const auto& c : its_candidates) {
if (std::equal(c.rbegin(), c.rend(), _name.rbegin())) { /// <===== HERE
return true;
}
}
return false;
}
Filenames are compared from the end and number of compared characters is equal to the shorter filename.
If every file has its own user assigned then it can lead to the warnings: Reading of configuration file ... failed. Configuration may be incomplete. In case when other user wants to read this file.
Is this done by purpose?