Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asio: object_server: remove invalid root interface
Right now a trivial snippet of code will throw an exception: ``` boost::asio::io_service io; auto systemBus = std::make_shared<sdbusplus::asio::connection>(io); systemBus->request_name(this_name); sdbusplus::asio::object_server objectServer(systemBus); ``` In commit 017a19d, code was added to detect the return code from `sd_bus_add_object_vtable` and turn it into an exception. It turns out that our existing `asio::object_server` is triggering this exception itself. I traced the issue down to the empty-named interface being added into the / path by `asio::object_server`: ``` auto root = add_interface("/", ""); ``` Empty interface names are invalid and thus this gives us an error from `sd_bus_add_object_vtable`. I cannot tell the history or rationale on this code, because it has been around from the beginning, but I suspect at one point if we didn't have _some_ object we also did not get an `ObjectManager` interface. I deleted this code now and confirmed we do still get an `ObjectManager`. ``` $ busctl --user tree xyz.openbmc_project.sdbusplus.test.Aio Only root object discovered. $ busctl --user introspect xyz.openbmc_project.sdbusplus.test.Aio / | grep interface org.freedesktop.DBus.Introspectable interface - - - org.freedesktop.DBus.ObjectManager interface - - - org.freedesktop.DBus.Peer interface - - - org.freedesktop.DBus.Properties interface - - - ``` Since we still get an `ObjectManager` and this code likely hasn't worked for quite a while, but was silently ignoring the error from sd-bus, I think we are safe to remove it. Reported-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I989ae218a882bc2e45594cb380d318e6a8f0f17e
- Loading branch information