[Bug 292262] netstat: numerous space-padded fields in JSON output
Date: Thu, 08 Jan 2026 00:11:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292262
Bug ID: 292262
Summary: netstat: numerous space-padded fields in JSON output
Product: Base System
Version: 16.0-CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: asomers@FreeBSD.org
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.
--
You are receiving this mail because:
You are the assignee for the bug.