[systemd-devel] GetMachineId implementation in libsystemd

Stanislav Angelovič angelovic.s at gmail.com
Mon Sep 23 13:13:26 UTC 2019


Hi guys,

I have two questions regarding implementation
of org.freedesktop.DBus.Peer.GetMachineId() in libsystemd.

1. The method only checks the '/etc/machine-id' file. If libsystemd, which
contains sd-bus implementation, which is quite self-contained and
systemd-independent, is used in a non-systemd linux environment, the file
does not exist. Hence, GetMachineId fails. But there is
'/var/lib/dbus/machine-id' available, created by dbus package itself.

Shouldn't the method also check the presence of the latter file if the
former one doesn't exist? I can prepare the patch if it's ok.

2. Error handling issue. If the file is not there, the corresponding C
function returns error value, which winds all the way up to
sd_bus_process() which returns error. This seems to me like mixing levels
of errors. I thought that when sd_bus_process returns error, we have
serious problem because something bus infrastructure-related failed.
Shouldn't the method just return a D-Bus error reply and in C function
return OK (because the method body was found and executed, so from sd-bus
view things are fine, but on the application level the method could not
finish properly, so it sends error message to the caller)? Also here I can
prepare a patch, if it's ok.

Thanks, and cheers.

Stanislav.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190923/ddd575de/attachment.html>


More information about the systemd-devel mailing list