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 017a19da, 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
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 7a3e8e7..2c65ace 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -799,8 +799,6 @@
{
if (!skipManager)
{
- auto root = add_interface("/", "");
- root->initialize();
add_manager("/");
}
}