diff --git a/src/sysupdate/sysupdate.c b/src/sysupdate/sysupdate.c index b0de03afdd..4f55ccdafb 100644 --- a/src/sysupdate/sysupdate.c +++ b/src/sysupdate/sysupdate.c @@ -3092,14 +3092,11 @@ static int verb_components(int argc, char *argv[], uintptr_t _data, void *userda if (r < 0) return table_log_add_error(r); - const char *doc = cc.component_documentation ? cc.component_documentation[0] : NULL; - r = table_add_many( t, TABLE_STRING, *i, TABLE_STRING, cc.component_description, - TABLE_STRING, doc, - TABLE_SET_URL, doc); + TABLE_STRV_WRAPPED, cc.component_documentation); if (r < 0) return table_log_add_error(r); } @@ -3108,8 +3105,9 @@ static int verb_components(int argc, char *argv[], uintptr_t _data, void *userda } else { _cleanup_(sd_json_variant_unrefp) sd_json_variant *json = NULL; - r = sd_json_buildo(&json, SD_JSON_BUILD_PAIR_BOOLEAN("default", has_default_component), - SD_JSON_BUILD_PAIR_STRV("components", component_names)); + r = sd_json_buildo(&json, + SD_JSON_BUILD_PAIR_BOOLEAN("default", has_default_component), + SD_JSON_BUILD_PAIR_STRV("components", component_names)); if (r < 0) return log_error_errno(r, "Failed to create JSON: %m"); diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index 554f7665a8..0de5ecd370 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -699,6 +699,11 @@ done # that a ‘default’ component is only listed by sysupdate if it’s fully configured mv "$CONFIGDIR" "$CONFIGDIR.backup" mkdir -p /run/sysupdate.some-component.d +cat >/run/sysupdate.some-component.component </dev/null +component_output="$("$SYSUPDATE" components)" +grep -F "https://example.com/some-component" <<<"$component_output" >/dev/null +grep -F "https://example.com/some-component-more" <<<"$component_output" >/dev/null varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -e '.targets | all(.id.class != "host")' >/dev/null mkdir /run/sysupdate.d "$SYSUPDATE" --json=short components | grep -F '{"default":false,"components":["some-component"]}' >/dev/null @@ -734,6 +742,7 @@ varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -e '.tar # Clean up regression test rmdir /run/sysupdate.d rm -rf /run/sysupdate.some-component.d +rm -f /run/sysupdate.some-component.component mv "$CONFIGDIR.backup" "$CONFIGDIR" # Make sure the processing of compressed streams still handles uncompressed streams shorter than