[rrd-developers] bug introduced

Alex van den Bogaerdt alex at ergens.op.het.net
Mon Nov 19 23:09:43 CET 2007


Hi,

It seems a change from version 1.2.20 to 1.2.21 introduced a bug.
Scenario: some rates NaN, some rates -1, Y-axis minimum value
is not set (not using --lower-limit).

for v in 20 21
do
        echo starting for 1.2.$v
        rrd=~/svn/1.2.$v/src/rrdtool

        echo create
        $rrd create $v.rrd -s 60 -b 1195426800 DS:x:GAUGE:120:U:U RRA:AVERAGE:0:1:10
        echo update
        $rrd update $v.rrd 1195427040:-1
        echo graph
        $rrd graph $v.png DEF:x=test.rrd:x:AVERAGE LINE1:x#FF0000:x
        echo all done
done


When I roll back the following change, this bug disappears.

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/


$ diff -u 1.2.20/src/rrd_graph.c 1.2.21/src/
--- 1.2.20/src/rrd_graph.c      2007-11-19 22:42:32.000000000 +0100
+++ 1.2.21/src/rrd_graph.c      2007-11-19 22:39:19.000000000 +0100
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.2.20  Copyright by Tobi Oetiker, 1997-2007
+ * RRDtool 1.2.21  Copyright by Tobi Oetiker, 1997-2007
  ****************************************************************************
  * rrd__graph.c  produce graphs from data in rrdfiles
  ****************************************************************************/
@@ -497,7 +497,10 @@
     double new_range = factor * (im->maxval - im->minval);
     double gridstep = im->ygrid_scale.gridstep;
     double minor_y, minor_y_px, minor_y_px_frac;
-    im->maxval = im->minval + new_range;
+    if (im->maxval > 0.0)
+      im->maxval = im->minval + new_range;
+    else
+      im->minval = im->maxval - new_range;
     ytr(im,DNAN); /* reset precalc */
     /* make sure first minor gridline is on integer pixel y coord */
     minor_y = gridstep * floor(im->minval / gridstep);



More information about the rrd-developers mailing list