JSON forbids duplicating a field name, at least if you care about the value of the first instance of the field. But currently, "gpart list --libxo=json" will print multiple "attrib" fields if a provider has multiple attributes set. For example: somers@fbsd-head ~> sudo gpart set -i 1 -a bootonce vtbd0 bootonce set on vtbd0p1 somers@fbsd-head ~> gpart show vtbd0 => 40 155189168 vtbd0 GPT (74G) 40 8 - free - (4.0K) 48 1024 1 freebsd-boot [bootonce,bootme] (512K) 1072 146800640 2 freebsd-ufs (70G) 146801712 8387488 3 freebsd-swap (4.0G) 155189200 8 - free - (4.0K) somers@fbsd-head ~> > gpart list --libxo=json,pretty ... { "name": "vtbd0p1", "mediasize": 524288, "sectorsize": 512, "stripesize": 8192, "stripeoffset": 0, "mode": "r0w0e0", "efimedia": "HD(1,GPT,b8949974-4a7e-11e9-ba65-e03f4944d7b6,0x30,0x400) ", "rawuuid": "b8949974-4a7e-11e9-ba65-e03f4944d7b6", "rawtype": "83bd6b9d-7f41-11dc-be0b-001560b84f0f", "attrib": "bootonce", "attrib": "bootme", "label": "", "length": "524288", "offset": "24576", "type": "freebsd-boot", "index": "1", "end": "1071", "start": "48" }, ... Notice the two "attrib" fields. They should be changed to a single field.
A commit in branch main references this bug: 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(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3b44f04225bc3f2ca33cff90273b8cdfea67774e commit 3b44f04225bc3f2ca33cff90273b8cdfea67774e Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2025-12-05 16:16:53 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2026-01-20 17:12:53 +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 Reviewed by: asomers Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D54080 (cherry picked from commit a0347b0f3a6088872c29eddb85154478d543dffb) sbin/geom/core/geom.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=46a760e578f553d54c2e2ef6b295d3e9c71bd558 commit 46a760e578f553d54c2e2ef6b295d3e9c71bd558 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2025-12-05 16:16:53 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2026-01-20 22:31:29 +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 Reviewed by: asomers Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D54080 (cherry picked from commit a0347b0f3a6088872c29eddb85154478d543dffb) sbin/geom/core/geom.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)