On Tue, 8 Aug 2017, Emmanuel Vadot wrote:

 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 <m...@josuah.net> (Original version)


Modified: head/usr.bin/vmstat/vmstat.c
--- head/usr.bin/vmstat/vmstat.c        Tue Aug  8 11:49:36 2017        
+++ head/usr.bin/vmstat/vmstat.c        Tue Aug  8 12:18:11 2017        
@@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
                        xo_emit(" ");
+                       xo_emit(" ");
                xo_emit("{:total-page-faults/%5lu} ",
                        (unsigned long)rate(sum.v_vm_faults -

This seems to break the formatting.  There was a negative amount of space
available for expansion, and since the header was not expanded to match
its alignment with the fields is more random than before.  With -h, the
width was 80 columns, giving ugly line wrap on 80-column terminals with
auto-wrap.  Now it is 81 columns, giving uglier line wrap on all 80-
column terminals.

The bugs were mostly in the first line of the header:
- the second line of the header was correct for vmstat -h
- for vmstat without -h, the second line of the header was apparently broken
  by a change like the one here, that added a space after the "r b w" fields
  without adding one in the "r b w" header
- most of the fields in the first line of the header are misaligned with the
  second lone.  Many have drifted 3 to the left of where the were in a sort
  of center-justified place.  Some of these might have actually been
  intended to be left justified, but had an off by +1 error.  Now these
  have an error of off by -2 relative to left justifications.

Only the "memory" header in the first line is better than in old versions.
It is now left justified.  Left justifying all headers in the first line
is probably best.  I couldn't find a good way to delimit the right hand
side of the extents of the headers in the first line.  The second line of
the headers already uses right justification consistently and this works

svn-src-head@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to