From afa99924299eb231ff832035d32841a1d384f720 Mon Sep 17 00:00:00 2001 From: Ivan Kruglov Date: Wed, 9 Jul 2025 05:54:07 -0700 Subject: [PATCH] core: fix double Environment present in both context and runtime --- src/core/varlink-manager.c | 3 +-- src/shared/varlink-io.systemd.Manager.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/varlink-manager.c b/src/core/varlink-manager.c index a54ee6ce3fd..c1e10468350 100644 --- a/src/core/varlink-manager.c +++ b/src/core/varlink-manager.c @@ -44,7 +44,7 @@ static int manager_context_build_json(sd_json_variant **ret, const char *name, v return sd_json_buildo( ASSERT_PTR(ret), - JSON_BUILD_PAIR_STRV_NON_EMPTY("Environment", m->transient_environment), + JSON_BUILD_PAIR_CALLBACK_NON_NULL("Environment", manager_environment_build_json, m), SD_JSON_BUILD_PAIR_STRING("DefaultStandardOutput", exec_output_to_string(m->defaults.std_output)), SD_JSON_BUILD_PAIR_STRING("DefaultStandardError", exec_output_to_string(m->defaults.std_error)), SD_JSON_BUILD_PAIR_BOOLEAN("ServiceWatchdogs", m->service_watchdogs), @@ -144,7 +144,6 @@ static int manager_runtime_build_json(sd_json_variant **ret, const char *name, v SD_JSON_BUILD_PAIR_UNSIGNED("NInstalledJobs", m->n_installed_jobs), SD_JSON_BUILD_PAIR_UNSIGNED("NFailedJobs", m->n_failed_jobs), SD_JSON_BUILD_PAIR_REAL("Progress", manager_get_progress(m)), - JSON_BUILD_PAIR_CALLBACK_NON_NULL("Environment", manager_environment_build_json, m), JSON_BUILD_PAIR_STRING_NON_EMPTY("WatchdogDevice", watchdog_get_device()), JSON_BUILD_PAIR_DUAL_TIMESTAMP_NON_NULL("WatchdogLastPingTimestamp", watchdog_get_last_ping_as_dual_timestamp(&watchdog_last_ping)), JSON_BUILD_PAIR_STRING_NON_EMPTY("ControlGroup", m->cgroup_root), diff --git a/src/shared/varlink-io.systemd.Manager.c b/src/shared/varlink-io.systemd.Manager.c index d1ed8e22b4a..a3cb2edc835 100644 --- a/src/shared/varlink-io.systemd.Manager.c +++ b/src/shared/varlink-io.systemd.Manager.c @@ -20,7 +20,7 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE( static SD_VARLINK_DEFINE_STRUCT_TYPE( ManagerContext, - SD_VARLINK_FIELD_COMMENT("https://www.freedesktop.org/software/systemd/man/latest/systemd-system.conf.html#ManagerEnvironment="), + SD_VARLINK_FIELD_COMMENT("https://www.freedesktop.org/software/systemd/man/"PROJECT_VERSION_STR"/systemd-system.conf.html#ManagerEnvironment="), SD_VARLINK_DEFINE_FIELD(Environment, SD_VARLINK_STRING, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE), SD_VARLINK_FIELD_COMMENT("https://www.freedesktop.org/software/systemd/man/"PROJECT_VERSION_STR"/systemd-system.conf.html#DefaultStandardOutput="), SD_VARLINK_DEFINE_FIELD(DefaultStandardOutput, SD_VARLINK_STRING, 0), @@ -143,8 +143,6 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE( SD_VARLINK_DEFINE_FIELD(NFailedJobs, SD_VARLINK_INT, 0), SD_VARLINK_FIELD_COMMENT("Boot progress as a floating point value between 0.0 and 1.0"), SD_VARLINK_DEFINE_FIELD(Progress, SD_VARLINK_FLOAT, 0), - SD_VARLINK_FIELD_COMMENT("The manager environment variables"), - SD_VARLINK_DEFINE_FIELD(Environment, SD_VARLINK_STRING, SD_VARLINK_ARRAY), SD_VARLINK_FIELD_COMMENT("The hardware watchdog device currently in use"), SD_VARLINK_DEFINE_FIELD(WatchdogDevice, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), SD_VARLINK_FIELD_COMMENT("Timestamp when the hardware watchdog was last pinged"), -- 2.47.3