]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
table: Fix JSON name mangling breaking changes 33609/head
authorAdrian Vovk <adrianvovk@gmail.com>
Thu, 11 Jul 2024 23:35:10 +0000 (19:35 -0400)
committerAdrian Vovk <adrianvovk@gmail.com>
Wed, 17 Jul 2024 18:15:44 +0000 (14:15 -0400)
In previous commits, we've changed the JSON name mangling logic. This,
of course, will cause breaking changes to occur on anything that relied
on the JSON mangling logic.

This commit fixes those breaking changes by manually forcing the JSON
name back to what it was before.

src/import/importctl.c
src/partition/repart.c
src/sysupdate/sysupdate.c

index 3334f37b946fec5cd9fa68a5c5113affc3beb99e..30566a19170c899bd98984c866f3d65ade81e719 100644 (file)
@@ -912,6 +912,11 @@ static int list_images(int argc, char *argv[], void *userdata) {
         (void) table_hide_column_from_display(t, 8);
         (void) table_hide_column_from_display(t, 10);
 
+        /* Starting in v257, these fields would be automatically formatted with underscores. However, this
+         * command was introduced in v256, so changing the field name would be a breaking change. */
+        (void) table_set_json_field_name(t, 8, "usage-exclusive");
+        (void) table_set_json_field_name(t, 10, "limit-exclusive");
+
         for (;;) {
                 uint64_t crtime, mtime, usage, usage_exclusive, limit, limit_exclusive;
                 const char *class, *name, *type, *path;
index 0509364063a3d4cb560fe2b6fc3c43a3d5588452..0ad8fad1509c353062926ed0eb4bc11bd871e659 100644 (file)
@@ -3043,6 +3043,10 @@ static int context_dump_partitions(Context *context) {
         if (!t)
                 return log_oom();
 
+        /* Starting in v257, these fields would be automatically formatted with underscores. This would have
+         * been a breaking change, so to avoid that let's hard-code their original names. */
+        table_set_json_field_name(t, 15, "drop-in_files");
+
         if (!DEBUG_LOGGING) {
                 if (arg_json_format_flags & SD_JSON_FORMAT_OFF)
                         (void) table_set_display(t, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4,
index 3fcb2839d09142e0a77167facd6ce7a4451a65e2..aded7dde0b4306a6a7849b54de9a65fa4fa1cd89 100644 (file)
@@ -470,6 +470,11 @@ static int context_show_version(Context *c, const char *version) {
         (void) table_set_align_percent(t, table_get_cell(t, 0, 8), 100);
         table_set_ersatz_string(t, TABLE_ERSATZ_DASH);
 
+        /* Starting in v257, these fields would be automatically formatted with underscores. This would have
+         * been a breaking change, so to avoid that let's hard-code their original names. */
+        (void) table_set_json_field_name(t, 7, "tries-done");
+        (void) table_set_json_field_name(t, 8, "tries-left");
+
         /* Determine if the target will make use of partition/fs attributes for any of the transfers */
         FOREACH_ARRAY(transfer, c->transfers, c->n_transfers) {
                 Transfer *tr = *transfer;