[systemd-devel] libsystemd/sd_bus: trouble understanding how to parse complex responses

Sergey Jin' Bostandzhyan jin at mediatomb.cc
Mon Sep 28 10:23:13 UTC 2020


Hi Lennart,

sorry for the late reaction, thanks to your help (especially the busctl
monitor hint) I was able to figure out what was going on.

On Wed, Sep 09, 2020 at 06:31:26PM +0200, Lennart Poettering wrote:
[...] 
> > At this point I am not sure if sd_bus actually behaves correctly and
> > GetManagedObjects() returns only one path or if I messed up the parsing of
> > the reply somehow? And I am not sure how to check that...
> >
> > I would like to avoid parsing XML if I can, but of course that option is
> > still there; nevertheless, I would first like to understand what is going on
> > with the GetManagedObjects() call and if the problem is really there or
> > somewhere else.
> 
> Consider using "busctl monitor" to see what the message your client
> receives actually contains.

The issue was that "busctl tree" returned a list of paths which I assumed would
be also present in the response of GetManagedObjects(), however - this was
not the case. Instead of being an object path on the same level as shown in 
busctl tree, the SIM path which I saw in the GetManagedObjects() reply was 
returned in a property. I simply missed that when looking at the busctl  
response in the console.

This explains why I was not getting the second path in the array when parsing
with sd_bus - it was really not there, I just thought it would be, because of
what I have seen in the busctl tree output.

So once again, thank you for the hints, it's solved now.

Kind regars,
Jin
 


More information about the systemd-devel mailing list