diff options
author | Daniel Norman <danielnorman@google.com> | 2020-11-09 17:28:24 -0800 |
---|---|---|
committer | Daniel Norman <danielnorman@google.com> | 2020-11-19 10:02:56 -0800 |
commit | f597fa5d1dca3b79b30d5b66e15e23b0bd91b560 (patch) | |
tree | ca5764b2ec1924d18bb7ea810f70594f8db9643e /init/service_parser.cpp | |
parent | 7e62aa568c7198c47afeada707e144fb336ba151 (diff) |
Returns a service parse error on overrides across the treble boundary.
Also includes new --out_<partition> flags for
system,system_ext,product,vendor,odm
to allow host_init_verifier to work with a collection of init rc files.
Test: host_init_verifier --out_system=... --out_vendor=...
where vendor contains an init rc file that overrides a service
present in system. Observe parse failure and non-zero exit.
Bug: 163089173
Change-Id: I520fef613e0036df8a7d47a98d47405eaa969110
Diffstat (limited to 'init/service_parser.cpp')
-rw-r--r-- | init/service_parser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 97621dac6..57c311a52 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -657,6 +657,14 @@ Result<void> ServiceParser::EndSection() { << "' with a config in APEX"; } + std::string context = service_->subcontext() ? service_->subcontext()->context() : ""; + std::string old_context = + old_service->subcontext() ? old_service->subcontext()->context() : ""; + if (context != old_context) { + return Error() << "service '" << service_->name() << "' overrides another service " + << "across the treble boundary."; + } + service_list_->RemoveService(*old_service); old_service = nullptr; } |