Hi,

I believe there is a loop iteration error in /etc/init.d/sensors in starting 
and stopping the service. The loop going through the modules stops one 
iteration too early.

~> rpm -qa|grep sensors
liblm_sensors1-2.6.4-4mdk
lm_sensors-2.6.4-4mdk

~>cat /etc/sysconfig/lm_sensors
[clipped comments]
# Generated by sensors-detect on Sun Sep  1 16:37:41 2002
MODULE_1=i2c-viapro
MODULE_2=i2c-isa
MODULE_3=adm1021
MODULE_4=eeprom
MODULE_5=w83781d

Here's the relevant section from /etc/init.d/sensors in the start) block:
        modules=`grep \^MODULE_ $CONFIG | wc -l`
        i=0
        while [ $i -lt $modules ] ; do
                module=`eval echo '$'MODULE_$i`
                /sbin/modprobe $module &>/dev/null
                i=`expr $i + 1`
        done

It exists as well in the stop) block.

As you can see, modules 1-4 are loaded, but not MODULE_5 because i becomes 5 
and then is no longer less than 5. So in my case, module w83781d never gets 
loaded. My simple patch to fix it was to move the increment up ahead of the 
eval call, since there is no MODULE_0 anyway. The patch is attached.

I believe this is the proper venue and method to report a bug. The previous 
email I sent about KDEHOME not being honored in the /usr/bin/startkde 
script has no reply so far, and I believe it merits fixing before Mandrake 
9.0 is released, as well.

Thanks,
Robby Stephenson
--- sensors.orig	2002-09-01 16:52:48.000000000 -0700
+++ sensors	2002-09-01 16:58:46.000000000 -0700
@@ -44,9 +44,9 @@
         modules=`grep \^MODULE_ $CONFIG | wc -l`
         i=0
         while [ $i -lt $modules ] ; do
+		i=`expr $i + 1`
                 module=`eval echo '$'MODULE_$i`
 		/sbin/modprobe $module &>/dev/null
-		i=`expr $i + 1`
 	done
 	echo
 	# Set Alarm
@@ -69,9 +69,9 @@
         modules=`grep \^MODULE_ $CONFIG | wc -l`
         i=0
         while [ $i -lt $modules ] ; do
+		i=`expr $i + 1`
                 module=`eval echo '$'MODULE_$i`
 		/sbin/modprobe -r $module &>/dev/null
-		i=`expr $i + 1`
 	done
 	echo
 

Reply via email to