Subject: bin/8671: bug in systat
To: None <gnats-bugs@gnats.netbsd.org>
From: Paul Shupak <paul@Plectere.com>
List: netbsd-bugs
Date: 10/23/1999 17:21:54
>Number:         8671
>Category:       bin
>Synopsis:       display of io:numbers is wrong for large numbers of drives
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 23 17:20:59 1999
>Last-Modified:
>Originator:     Paul Shupak
>Organization:
>Release:        NetBSD-current Sat Oct 23 1999
>Environment:

System: NetBSD svcs 1.4K NetBSD 1.4K (PCOM) #17: Thu Oct 7 16:25:37 PDT 1999 paul@cobalt:/usr/src/sys/arch/i386/compile/PCOM i386

>Description:
		When calculating the number of drives per line, the code uses
	different expressions for the labels versus the data itself:  This
	causes the labels to not match ( e.g when displaying 8 spindles in
	two groups, there are 4 names per group but five sets of data in the
	first and three sets in the second ).
		Additionally, the computation has a "greater-than-or-equal"
	when it should be just "greater-than".  Also, the format strings
	passed to printf contains a space, where increasing the field width
	is more appropriate ( i.e. when overflowing by one digit, the columns
	will still be aligned ).

>How-To-Repeat:

	On a machine with 5 or more spindles ( for a 80 column display ),
	run "systat io", then change the display format with ":numbers"
	and notice that the display is wrong.

>Fix:

*** iostat.c-ORIG	Fri Oct 22 18:05:22 1999
--- iostat.c	Fri Oct 22 18:02:44 1999
***************
*** 141,143 ****
  #define COLWIDTH	14
! #define DRIVESPERLINE	((getmaxx(wnd) - INSET) / COLWIDTH)
  	for (ndrives = 0, i = 0; i < dk_ndrive; i++)
--- 141,143 ----
  #define COLWIDTH	14
! #define DRIVESPERLINE	(getmaxx(wnd) / COLWIDTH)
  	for (ndrives = 0, i = 0; i < dk_ndrive; i++)
***************
*** 159,161 ****
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH >= getmaxx(wnd) - INSET) {
  				col = 0, row += linesperregion + 1;
--- 159,161 ----
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH > getmaxx(wnd)) {
  				col = 0, row += linesperregion + 1;
***************
*** 235,237 ****
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH >= getmaxx(wnd)) {
  				col = 0, row += linesperregion + 1;
--- 235,237 ----
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH > getmaxx(wnd)) {
  				col = 0, row += linesperregion + 1;
***************
*** 261,263 ****
  	if (numbers) {
! 		mvwprintw(wnd, row, col, " %3.0f%4.0f%5.1f",
  		    words / etime, cur.dk_xfer[dn] / etime, atime / etime);
--- 261,263 ----
  	if (numbers) {
! 		mvwprintw(wnd, row, col, "%4.0f%4.0f%5.1f",
  		    words / etime, cur.dk_xfer[dn] / etime, atime / etime);
>Audit-Trail:
>Unformatted: