From: Yu Watanabe Date: Fri, 30 May 2025 19:30:43 +0000 (+0900) Subject: bus-unit-util: warn and ignore assignment of deprecated properties X-Git-Tag: v258-rc1~409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=add1bc28d30bfb3ee2ccc804221a635cf188b733;p=thirdparty%2Fsystemd.git bus-unit-util: warn and ignore assignment of deprecated properties With 5da476ac7728b91ad3a49c1b126b3559b4fbeed8, we refused to set the properties, but this relaxes the behavior, and now commands warn and ignore the assignment. Also, assignment of CPUAccounting property is now warned and ignored, which is deprecated by 29da53dde32a0097134f6c3ba5fb5220dd6e5423. Prompted by https://github.com/systemd/systemd/pull/37665#discussion_r2115676993 --- diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 328caca3396..1e28622668c 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -71,6 +71,11 @@ int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { &u->job_path); } +static int warn_deprecated(const char *field, const char *eq) { + log_warning("D-Bus property %s is deprecated, ignoring assignment: %s=%s", field, field, eq); + return 1; +} + #define DEFINE_BUS_APPEND_PARSE_PTR(bus_type, cast_type, type, parse_func) \ static int bus_append_##parse_func( \ sd_bus_message *m, \ @@ -590,8 +595,7 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons return 1; } - if (STR_IN_SET(field, "CPUAccounting", - "MemoryAccounting", + if (STR_IN_SET(field, "MemoryAccounting", "MemoryZSwapWriteback", "IOAccounting", "TasksAccounting", @@ -1029,6 +1033,19 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons * means use the default memory pressure duration from oomd.conf. */ return bus_append_parse_sec_rename(m, field, isempty(eq) ? "infinity" : eq); + if (STR_IN_SET(field, + "MemoryLimit", + "CPUShares", + "StartupCPUShares", + "BlockIOAccounting", + "BlockIOWeight", + "StartupBlockIOWeight", + "BlockIODeviceWeight", + "BlockIOReadBandwidth", + "BlockIOWriteBandwidth", + "CPUAccounting")) + return warn_deprecated(field, eq); + return 0; }