netstat has libxo support. But its encoded output forms include numerous fields with space-padding where it doesn't belong. For example: $ netstat -c -p tcp -n --libxo=json,pretty | grep stack | sort | uniq "stack": "bbr " "stack": "freebsd" The common pattern in the code is xo_emit calls with field-format specifiers that include strings with widths, and no encoding-format specifiers. For example, the above lines were caused by: xo_emit(" {:stack/%-*.*s}", Most such instances can be caught by this regex: "xo_emit[^/{]*\{[^}/]*/[^}/]*\}". There are hundreds.
I can work on this if you want. Unless you've already started?
(In reply to Johan Söllvander from comment #1) No, I'm not planning to. If you want to, great. I'll review it.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=faa31fc0e7acc1c53bba2b69a63e9ff55d24faf7 commit faa31fc0e7acc1c53bba2b69a63e9ff55d24faf7 Author: Johan Söllvander <js@FreeBSD.org> AuthorDate: 2026-01-15 14:21:07 +0000 Commit: Johan Söllvander <js@FreeBSD.org> CommitDate: 2026-01-15 14:21:07 +0000 netstat: Remove padding from cc and stack fields Trim white space padding that gets added libxo fields cc and stack when using -C and -c. The padding is only visible if you're using multiple stacks or congestion algorithms. PR: 292262 MFC after: 5 days Reviewed by: asomers, tuexen Approved by: asomers (mentor) Differential Revision: https://reviews.freebsd.org/D54709 usr.bin/netstat/inet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=01ffd4516f3ce26d0b6d797818b47a974e7caabf commit 01ffd4516f3ce26d0b6d797818b47a974e7caabf Author: Johan Söllvander <js@FreeBSD.org> AuthorDate: 2026-01-15 14:21:07 +0000 Commit: Johan Söllvander <js@FreeBSD.org> CommitDate: 2026-01-20 11:47:30 +0000 netstat: Remove padding from cc and stack fields Trim white space padding that gets added libxo fields cc and stack when using -C and -c. The padding is only visible if you're using multiple stacks or congestion algorithms. PR: 292262 Reviewed by: asomers, tuexen Approved by: asomers (mentor) Differential Revision: https://reviews.freebsd.org/D54709 (cherry picked from commit faa31fc0e7acc1c53bba2b69a63e9ff55d24faf7) usr.bin/netstat/inet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=af46d309a72b73398c3d0e4bee9b21437af17d7a commit af46d309a72b73398c3d0e4bee9b21437af17d7a Author: Johan Söllvander <js@FreeBSD.org> AuthorDate: 2026-01-15 14:21:07 +0000 Commit: Johan Söllvander <js@FreeBSD.org> CommitDate: 2026-01-20 13:25:39 +0000 netstat: Remove padding from cc and stack fields Trim white space padding that gets added libxo fields cc and stack when using -C and -c. The padding is only visible if you're using multiple stacks or congestion algorithms. PR: 292262 Reviewed by: asomers, tuexen Approved by: asomers (mentor) Differential Revision: https://reviews.freebsd.org/D54709 (cherry picked from commit faa31fc0e7acc1c53bba2b69a63e9ff55d24faf7) usr.bin/netstat/inet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)