Subject: bin/36458: "envstat -r" doesn't show everything "envstat" shows
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Greg A. Woods <woods@planix.com>
List: netbsd-bugs
Date: 06/08/2007 01:30:00
>Number: 36458
>Category: bin
>Synopsis: "envstat -r" doesn't show what "envstat" shows
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Jun 08 01:30:00 +0000 2007
>Originator: Greg A. Woods
>Release: NetBSD 4.0_BETA2
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD 4.0_BETA2
Architecture: i386
Machine: i386
>Description:
At first glance it seemed as if "envstat -r" had an off-by-one
bug of some sort since it wasn't showing all the same sensors
that a plain "envstat" showed. Co-incidentally it was the first
sensor that wasn't appearing in the output.
Upon examining the source I see that "-r" has some undocumented
features that are less than appealing.
(BTW, I think the columnar form output is just totally useless.
It can't even be read by a human, let alone a program.)
>How-To-Repeat:
note the first sensor is not present in the "envstat -r" output
# envstat -l
DASD Temp
CPU 2 Temp
CPU 1 Temp
Ambient Temp
Fan 7b Tach
Fan 7a Tach
Fan 6b Tach
Fan 6a Tach
Fan 5b Tach
Fan 5a Tach
Fan 4b Tach
Fan 4a Tach
Fan 3 Tach
Fan 2 Tach
Fan 1 Tach
VBAT
12VB Sense
CPU Vtt
CPU 2 VCore
CPU 1 VCore
-12V Sense
5V Sense
12VC Sense
12VA Sense
1.8V Sense
1.5V Sense
# envstat -r
CPU 2 Temp: 35.000 degC
CPU 1 Temp: 34.000 degC
Ambient Temp: 26.000 degC
Fan 7b Tach: 9600 RPM
Fan 7a Tach: 6525 RPM
Fan 6b Tach: 9225 RPM
Fan 6a Tach: 6675 RPM
Fan 5b Tach: 9300 RPM
Fan 5a Tach: 6825 RPM
Fan 4b Tach: 9525 RPM
Fan 4a Tach: 6600 RPM
Fan 3 Tach: 10500 RPM
Fan 2 Tach: 9825 RPM
Fan 1 Tach: 9900 RPM
VBAT: 3.136 V
12VB Sense: 12.825 V
CPU Vtt: 1.220 V
CPU 2 VCore: 1.050 V
CPU 1 VCore: 1.270 V
-12V Sense: -11.412 V
5V Sense: 4.992 V
12VC Sense: 12.159 V
12VA Sense: 12.825 V
1.8V Sense: 1.880 V
1.5V Sense: 1.560 V
#
>Fix:
Index: usr.sbin/envstat/envstat.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/usr.sbin/envstat/envstat.c,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 envstat.c
--- usr.sbin/envstat/envstat.c 8 May 2007 10:45:17 -0000 1.23.2.1
+++ usr.sbin/envstat/envstat.c 8 Jun 2007 01:19:06 -0000
@@ -220,14 +220,12 @@
if (cetds[i] == 0)
continue;
- if ((etds[i].validflags & ENVSYS_FCURVALID) == 0)
- continue;
+ printf("%*.*s", (int)width, (int)width, ebis[i].desc);
- if (ebis[i].units == ENVSYS_INDICATOR &&
- etds[i].cur.data_s == 0)
+ if ((etds[i].validflags & ENVSYS_FCURVALID) == 0) {
+ printf(": %10s\n", "*");
continue;
-
- printf("%*.*s", (int)width, (int)width, ebis[i].desc);
+ }
/* different units need some magic */
switch (ebis[i].units)
{
@@ -235,6 +233,7 @@
printf(": drive %s",
envsysdrivestatus[etds[i].cur.data_us]);
case ENVSYS_INDICATOR:
+ printf(": %10s", etds[i].cur.data_us ? "ON" : "OFF");
break;
case ENVSYS_INTEGER:
printf(": %10d", etds[i].cur.data_s);
@@ -266,7 +265,7 @@
etds[i].max.data_s);
}
- printf("\n");
+ putchar('\n');
}
}
>Unformatted: