Summary: | vmstat output have columns without space | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Josuah Demangeon <mail> | ||||
Component: | bin | Assignee: | Oleksandr Tymoshenko <gonzo> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | gonzo | ||||
Priority: | --- | Keywords: | patch | ||||
Version: | 11.0-RELEASE | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272438 | ||||||
Attachments: |
|
A commit references this bug: Author: manu Date: Tue Aug 8 12:18:11 UTC 2017 New revision: 322252 URL: https://svnweb.freebsd.org/changeset/base/322252 Log: vmstat: Always emit a space after the free-memory column When displaying in non-human form, if the free-memory number is large (more than 7 digits), there is no space between it and the page fault column. PR: 221290 Submitted by: Josuah Demangeon <mail@josuah.net> (Original version) Changes: head/usr.bin/vmstat/vmstat.c I'll take care of MFC ^Triage: committed back in 2017. |
Created attachment 185098 [details] I attached a patch applied to the git repo, and I could not test it with this version, but applying the same edit on 11.0-RELEASE worked fine. vmstat displays humanized numbers while stdout is a TTY. But while piping out through, say, tee(1), the numbers under fre and flt are displayed without any " " when flt's numbers are too big. To reproduce: ─── stress -m 1 -t 3 & vmstat 1 3 | tee [1] 9628 stress: info: [9628] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd procs memory page disks faults cpu r b w avm fre flt re pi po fr sr ad0 pa0 in sy cs us sy id 1 0 0 4691676 12188436 1408 0 173 8 1490 171 0 0 192 6998 1832 8 1 91 1 0 0 4935316 12036000496115 0 0 12 461929 229 0 0 3 372 156 4 23 73 1 0 0 4935316 12062292518046 0 0 0 527749 287 0 0 2 627 170 3 24 73 stress: info: [9628] successful run completed in 3s ─── By adding a xo_emit(" ") on dovmstat() { ... } seems to fix the problem (see attached patch).