Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 14784 - lm_sensors initscript misreads /etc/sysconfig/lm_sensors
Summary: lm_sensors initscript misreads /etc/sysconfig/lm_sensors
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Brandon Low (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-30 12:07 UTC by Anders Bruun Olsen
Modified: 2003-06-08 15:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Few fixes to lm_sensors-2.7.0 init script and sensors-detect. (lm_sensors-2.7.0-r1-changes.tar.bz2,5.54 KB, application/octet-stream)
2003-03-01 21:56 UTC, Rudo Thomas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Bruun Olsen 2003-01-30 12:07:21 UTC
User-Agent:       
Build Identifier: 

in /etc/sysconfig/lm_sensors the sensors-detect script writes a file detailing
which modules to load, it starts with MODULE_0 and goes up, but the initscript
starts the loading at 1, so MODULE_0 is never loaded!
Also, /etc/sysconfig is not created during merge of lm_sensors!

Reproducible: Always
Steps to Reproduce:
1. merge lm_sensors-2.7.0
2. mkdir /etc/sysconfig; sensors-detect
3. /etc/init.d/lm_sensors start

Actual Results:  
the first listed module ain't loaded

Expected Results:  
loaded the module

This section:
        i=1
        while [ ${i} -le ${modules} ] ; do
                module=`eval echo '$'MODULE_${i}`
                ebegin "  Loading ${module}"
                modprobe ${module} &>/dev/null
                eend $?
                i=$((i+1))
        done

Needs to be changed to this:

        i=0
        while [ ${i} -lt ${modules} ] ; do
                module=`eval echo '$'MODULE_${i}`
                ebegin "  Loading ${module}"
                modprobe ${module} &>/dev/null
                eend $?
                i=$((i+1))
        done

to fix this. Notice "i=1" becomes "i=0" and "-le" becomes "-lt".

Also the ebuild script should mkdir /etc/sysconfig.
Comment 1 Rudo Thomas 2003-03-01 17:29:40 UTC
I propose a different approach. 
 
The grep anc wc -l commands in backquotes are overkill, consider the following. In 
my opinion, this is clearer, though maybe still not the right way to do it. 
 
i=0 
while true; do 
	module=`eval echo '$'MODULE_${i}` 
	if [ -z "${module}" ] ; then 
		break 
	fi 
	ebegin "  Loading ${module}" 
	modprobe ${module} &>/dev/null 
	eend $? 
	i=$((i+1)) 
done 
 
Comment 2 Brandon Low (RETIRED) gentoo-dev 2003-03-01 17:36:19 UTC
Hmm... the init script should be looking in /etc/conf.d for the lm_sensors config file... I don't know why who what (did I?) made it the way it is... and we need to hack up lm_sensors scripts to write that file out to /etc/conf.d I'll try to get to this, but if someone else out there wants to do it, feel free.
Comment 3 Rudo Thomas 2003-03-01 21:56:09 UTC
Created attachment 8865 [details]
Few fixes to lm_sensors-2.7.0 init script and sensors-detect.

Unpack, read the README, test.

Fixes the original bug, changes the init script and sensors-detect as suggested
in comment #2.

Time to go to sleep now 8-)
Comment 4 Rudo Thomas 2003-03-01 21:58:39 UTC
That's "Few fixes...", it's 4AM ;-) 
Comment 5 Brandon Low (RETIRED) gentoo-dev 2003-04-13 00:48:12 UTC
Sorry it's been a while, but that is a .tar.gz, eh?  Thanks, I'll look at it like soon.
Comment 6 Rudo Thomas 2003-04-13 18:03:04 UTC
The .tar.bz2 file contains updated ChangeLog, ebuild, rc script and a petch to 
lm_sensors. 
Comment 7 Brandon Low (RETIRED) gentoo-dev 2003-06-08 15:13:46 UTC
finally applying, sorry about the delay.