diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index 602306d9b9a..c5b56b44d6a 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -890,7 +890,6 @@ static int action_dissect( _cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL; _cleanup_(table_unrefp) Table *t = NULL; _cleanup_free_ char *bn = NULL; - uint64_t size = UINT64_MAX; int r; assert(m); @@ -1009,7 +1008,7 @@ static int action_dissect( r = sd_json_buildo( &v, SD_JSON_BUILD_PAIR_STRING("name", bn), - SD_JSON_BUILD_PAIR_CONDITION(size != UINT64_MAX, "size", SD_JSON_BUILD_INTEGER(size)), + SD_JSON_BUILD_PAIR_CONDITION(m->image_size != UINT64_MAX, "size", SD_JSON_BUILD_INTEGER(m->image_size)), SD_JSON_BUILD_PAIR_INTEGER("sectorSize", m->sector_size), SD_JSON_BUILD_PAIR_CONDITION(a >= 0, "architecture", SD_JSON_BUILD_STRING(architecture_to_string(a))), SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->image_uuid), "imageUuid", SD_JSON_BUILD_UUID(m->image_uuid)), diff --git a/test/units/TEST-50-DISSECT.dissect.sh b/test/units/TEST-50-DISSECT.dissect.sh index 9fc15d04da7..5a56da55f79 100755 --- a/test/units/TEST-50-DISSECT.dissect.sh +++ b/test/units/TEST-50-DISSECT.dissect.sh @@ -19,6 +19,7 @@ fi systemd-dissect --json=short "$MINIMAL_IMAGE.raw" | \ grep -F '{"rw":"ro","designator":"root","partition_uuid":null,"partition_label":null,"fstype":"squashfs","architecture":null,"verity":"external"' >/dev/null +systemd-dissect --json=short "$MINIMAL_IMAGE.raw" | grep -F '"size":' >/dev/null systemd-dissect "$MINIMAL_IMAGE.raw" | grep -F "MARKER=1" >/dev/null # shellcheck disable=SC2153 systemd-dissect "$MINIMAL_IMAGE.raw" | grep -F -f <(sed 's/"//g' "$OS_RELEASE") >/dev/null