JSON when used with `-w` flag ``` # vmstat --libxo json -w 5 {"__version": "1", "processes": {"runnable":63,"waiting":9,"swapped-out":2} , "memory": {"available-memory":" 36G","free-memory":" 1.2G","total-page-faults":4593} , "paging-rates": {"page-reactivated":5,"paged-in":0,"paged-out":22,"freed":6717,"scanned":722} , "device": [{"name":"da0","transfers":"0"}, {"name":"da1","transfers":"0"}], "fault-rates": {"interrupts":1169,"system-calls":68996,"context-switches":39163} , "cpu-statistics": {"user":" 8","system":"21","idle":"71"} , "processes": {"runnable":51,"waiting":9,"swapped-out":2} , "memory": {"available-memory":" 37G","free-memory":" 1.2G","total-page-faults":4576} , "paging-rates": {"page-reactivated":0,"paged-in":0,"paged-out":47,"freed":3771,"scanned":3834} , "device": [{"name":"da0","transfers":"0"}, {"name":"da1","transfers":"17"}], "fault-rates": {"interrupts":421,"system-calls":106121,"context-switches":19317} , "cpu-statistics": {"user":"87","system":"13","idle":" 0"} ``` (space added between successive outputs). I'd expect either json lines or back-to-back complete json objects but the second iteration returns a partial blob ``` # vmstat --libxo xml <processes version="1"><runnable>30</runnable><waiting>9</waiting><swapped-out>2</swapped-out></processes><memory><available-memory value="39004778496"> 36G</available-memory><free-memory value="1409699840"> 1.3G</free-memory><total-page-faults>4592</total-page-faults></memory><paging-rates><page-reactivated>5</page-reactivated><paged-in>0</paged-in><paged-out>22</paged-out><freed>6713</freed><scanned>728</scanned></paging-rates><device><name>da0</name><transfers>0</transfers></device><device><name>da1</name><transfers>0</transfers></device><fault-rates><interrupts>1168</interrupts><system-calls>69080</system-calls><context-switches>39135</context-switches></fault-rates><cpu-statistics><user> 8</user><system>21</system><idle>71</idle></cpu-statistics> ``` XML is missing root element. Using `-w` prints successive like the above example Not sure if these issues are related but in both cases there are issues with the libxo output
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c7dd97ec99687996de49ec0b1a23bf007e5199b9 commit c7dd97ec99687996de49ec0b1a23bf007e5199b9 Author: Bram Ton <bram@cbbg.nl> AuthorDate: 2024-07-17 07:23:30 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2024-09-03 01:22:14 +0000 vmstat: Add root element to libxo output Current libxo output does not have a root element. Valid XML requires a single root element. This commit adds this root element. The libxo output version bumped accordingly. PR: 254635 MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1330 usr.bin/vmstat/vmstat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5297156047f29274c9b6e68a514e72a858059890 commit 5297156047f29274c9b6e68a514e72a858059890 Author: Bram Ton <bram@cbbg.nl> AuthorDate: 2024-07-17 07:23:30 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2024-09-10 04:29:34 +0000 vmstat: Add root element to libxo output Current libxo output does not have a root element. Valid XML requires a single root element. This commit adds this root element. The libxo output version bumped accordingly. PR: 254635 Pull Request: https://github.com/freebsd/freebsd-src/pull/1330 (cherry picked from commit c7dd97ec99687996de49ec0b1a23bf007e5199b9) usr.bin/vmstat/vmstat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)