Re: GetMachineId implementation in libsystemd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mo, 23.09.19 15:13, Stanislav Angelovič (angelovic.s@xxxxxxxxx) wrote:

> 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.

Nah. Instead, create a symlink on your arch. afaik dbus even can reach
the machine ID from /etc nowadays.

At his point I am not convinced we should add kludges for this anymore.

> 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.

At this point the machine ID is not optional, and sd_bus_process()
will return errors for all error conditions that are not known to be
transient. This is just one of them.

Really, just move the machine ID to /etc, or symlink it.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux