From a0347b0f3a6088872c29eddb85154478d543dffb Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 5 Dec 2025 09:16:53 -0700 Subject: [PATCH] gpart: "gpart --libxo:JP list" duplicates attribute keys Add leaf-list modifier to attrib as it's possible to have multiple attributes on a gpart provider. I purposely made it so that the normal output still says "attrib:" just so we don't break any scripts people may be using to parse the output, but the libxo output now says "attribute" just like `gpart show` will do once https://reviews.freebsd.org/D53950 is merged. PR: 291377 MFC after: 1 week Reviewed by: asomers Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D54080 --- sbin/geom/core/geom.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index 51ea52a3e85..a1b1b351ebb 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -912,8 +912,12 @@ list_one_provider(struct gprovider *pp, const char *padding) } xo_emit("{P:/%s}{Lcw:Mode}{:mode}\n", padding, pp->lg_mode); LIST_FOREACH(conf, &pp->lg_config, lg_config) { - xo_emit("{P:/%s}{Lcwa:}{a:}\n", padding, conf->lg_name, - conf->lg_name, conf->lg_val ? conf->lg_val : ""); + if (strcmp(conf->lg_name, "attrib") != 0) + xo_emit("{P:/%s}{Lcwa:}{a:}\n", padding, conf->lg_name, + conf->lg_name, conf->lg_val ? conf->lg_val : ""); + else + xo_emit("{P:/%s}{Lcw:attrib}{l:attribute}\n", padding, + conf->lg_val ? conf->lg_val : ""); } }