Hi Helmut, I can reproduce the issue here.Since we don't ship any Debian specific patches in that regard, it would be awesome if you can raise this upstream at
https://github.com/systemd/systemd/issues I quickly searched through existing PRs and issues but didn't find anything. Am 12.10.22 um 06:19 schrieb Helmut Grohne:
Package: systemd Version: 251.5-1 Hi, logind seems confused # busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower b true # /lib/systemd/systemd-ac-power --verbose no # The system in question actually is running on battery. Both appear to be using the on_ac_power() C function. When running strace on the latter one can vaguely guess that on_ac_power() is actually run. When running strace on logind however, the sendmsg call happens immediately after the recvmsg call, so it seems like on_ac_power() is not actually run, but the value is cached or something. During boot, the system in question was on ac power. Looking closer, I now guess that the issue is here: https://sources.debian.org/src/systemd/251.5-2/src/login/logind-dbus.c/?hl=380#L380 Could it be that the function pointer is converted to boolean rather than being called? I.e. could it be that the function should actually be called? -static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", manager_is_on_external_power); +static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", manager_is_on_external_power());
The macro is defined as src/shared/bus-get-properties.h #define BUS_DEFINE_PROPERTY_GET_GLOBAL(function, bus_type, val) so what you say makes sense. There is a corresponding #define BUS_DEFINE_PROPERTY_GET(function, bus_type, data_type, get1)where "get1" is interpreted as a function. This inconsistency between those two macros is a bit of a pitfall I assume.
A "grep BUS_DEFINE_PROPERTY_GET_GLOBAL -R" doesn't reveal any other occurrences where this might be wrong. So it might just be the one spot that you found.
Regards, Michael
OpenPGP_signature
Description: OpenPGP digital signature