bug in cnfsstat

devnull at nimbus.ocis.temple.edu devnull at nimbus.ocis.temple.edu
Thu Jun 29 19:19:13 UTC 2000


i found a bug in cnfsstat [at least] in the latest BETA snapshot with the
reporting of size & position. there is a fix here, but i dont know perl, and
though it seems to work empirically, i dont know if i opened up another
problem or not (quick hack)

$ cnfsheadconf -c BUFFER
 Buffer BUFFER, len: 2048.00 Mbytes, used: 611.10 Mbytes (29.8%)   1 cycles
 Meta , order: 0, current: TRUE
 Newest: 2000-06-29 18:27:47,    0 days,  0:00:01 ago

$ cnfsstat -a
Class STUFF  for groups matching "*"
 Buffer BUFFER, size:  0.00 kBytes, position:  0.00 kBytes  1.00 cycles
  Newest: 2000-06-29 18:27:56,    0 days,  0:00:00 ago
  Oldest: 2000-06-28  8:01:49,    1 days, 10:26:07 ago


i looked at the script, and found the following lines in a subroutine called
'human_readable'

    my $unit = $#name;
    my $scaled = $val / $base / $factor**$unit;
    while ($scaled < 1 && $unit) {
	$scaled *= $factor;
	$unit--;
    }

debugging it showed that $scaled was getting initialized to zero

    my $unit = -1;
    my $oldscaled = $val / $base;
    my $scaled = $oldscaled;
    while ( ( $scaled > 0 ) && ( $unit < $#name ) ) {
        $oldscaled = $scaled;
        $scaled /= $factor;
        $unit++;
    }
    $scaled = $oldscaled;

and get:

$ cnfsstat -a
Class STUFF  for groups matching "*"
 Buffer BUFFER, size:  2.00 GBytes, position:   611 MBytes  1.00 cycles
  Newest: 2000-06-29 18:27:56,    0 days,  0:00:00 ago
  Oldest: 2000-06-28  8:01:49,    1 days, 10:26:07 ago

(the correct information)



More information about the inn-bugs mailing list