git: a0347b0f3a60 - main - gpart: "gpart --libxo:JP list" duplicates attribute keys
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Dec 2025 18:11:23 UTC
The branch main has been updated by asomers:
URL: https://cgit.FreeBSD.org/src/commit/?id=a0347b0f3a6088872c29eddb85154478d543dffb
commit a0347b0f3a6088872c29eddb85154478d543dffb
Author: Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2025-12-05 16:16:53 +0000
Commit: Alan Somers <asomers@FreeBSD.org>
CommitDate: 2025-12-10 18:08:30 +0000
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 51ea52a3e858..a1b1b351ebb3 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 : "");
}
}