Skip to contentSkip to conversation

sensors-detect path issue under fc5 / 6 -- fix

lm-sensors Jean Delvare 2 participants 3 messages Mar 4, 2007 – Apr 4, 2007

lore
Share & tools
lore
#0 lore raw

Hi Vince,

Moving the thread to the lm-sensors list, where it belongs.

Quoted 5 lines · Vince Spinelli

It's a simple one, but it's worth noting.

I'm unawares of other distributions, but under Fedora Core 5 and 6, the i2cdetect command is located in the /usr/sbin directory, not /sbin/ nor /usr/local/sbin.

That's the case of pretty much all distributions shipping lm-sensors, as /usr/local is meant for things added on top of the original distribution.

Quoted 2 lines

As a result, an error message is encountered when running sensors-detect.sh as either root, sudo root, or a normal user.

There's no such thing as "sensors-detect.sh" in our source package. sensors-detect is a perl script.

If your root user doesn't have /usr/sbin in its $PATH, then your setup is seriously broken, I doubt sensors-detect will be the only failing tool.

sensors-detect can no longer be run as non-root, so this case doesn't matter.

The su/sudo case is more problematic though, I can imagine a standard user gaining root permissions without getting the $PATH usually associated with the root user.

Quoted 27 lines

The fix is as follows... inside of the sensors-detect.sh script, there's a segment to add directories to path.

Change -->
# Just in case a root user doesn't have /sbin in his/her path for some reason # (was seen once)
$ENV{PATH} = '/sbin:'.$ENV{PATH}

	unless $ENV{PATH} =~ m,(^|:)/sbin/?(:|$),;
# Same for /usr/local/sbin since we need i2cdetect which is installed there
# by default (reported by Lennard Klein)
$ENV{PATH} = '/usr/local/sbin:'.$ENV{PATH}
	unless $ENV{PATH} =~ m,(^|:)/usr/local/sbin/?(:|$),;

To -->
# Just in case a root user doesn't have /sbin in his/her path for some reason # (was seen once)
$ENV{PATH} = '/sbin:'.$ENV{PATH}

	unless $ENV{PATH} =~ m,(^|:)/sbin/?(:|$),;
# Same for /usr/local/sbin since we need i2cdetect which is installed there
# by default (reported by Lennard Klein)
$ENV{PATH} = '/usr/local/sbin:'.$ENV{PATH}
	unless $ENV{PATH} =~ m,(^|:)/usr/local/sbin/?(:|$),;
# Same for /usr/sbin, for FC default dir (location of i2cdetect - V.
Spinelli)
$ENV{PATH} = '/usr/sbin:'.$ENV{PATH}
	unless $ENV{PATH} =~ m,(^|:)/usr/sbin/?(:|$),;
Quoted 1 line

And that fixes it.

Can you please provide a unified diff as everyone does, so that I can just apply it? Something like:
diff -u sensors-detect.orig sensors-detect
should do it.

Thanks,

Signature · 1 line
Jean Delvare
#1 lore raw
Quoted 21 lines · Jean Delvare
Quoted 5 lines · Vince Spinelli

It's a simple one, but it's worth noting.

I'm unawares of other distributions, but under Fedora Core 5 and 6, the i2cdetect command is located in the /usr/sbin directory, not /sbin/ nor /usr/local/sbin.

That's the case of pretty much all distributions shipping lm-sensors, as /usr/local is meant for things added on top of the original distribution.

Quoted 2 lines

As a result, an error message is encountered when running sensors-detect.sh as either root, sudo root, or a normal user.

There's no such thing as "sensors-detect.sh" in our source package. sensors-detect is a perl script.

If your root user doesn't have /usr/sbin in its $PATH, then your setup is seriously broken, I doubt sensors-detect will be the only failing tool.

Quoted 9 lines

sensors-detect can no longer be run as non-root, so this case doesn't matter.

The su/sudo case is more problematic though, I can imagine a standard user gaining root permissions without getting the $PATH usually associated with the root user.

Quoted 2 lines

The fix is as follows... inside of the sensors-detect.sh script, there's a segment to add directories to path.

I've made a functionally equivalent change to sensors-detect, committed to our SVN repository. Feel free to give it a try. Hopefully it will make the packagers happier.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Jean Delvare

I notice it's fixed now, but this needed to be added anyway, since the same counts for the dmidecode needed in the future, which is also (by default) installed in /usr/sbin instead /usr/local/sbin.

Just a reminder in case problems related to lmsensors or dmidecode show up in the future,

Ivo
----- Original Message -----
From: "Jean Delvare" <[email protected]>
To: "LM Sensors" <[email protected]>
Cc: "Vince Spinelli" <[email protected]>
Sent: Wednesday 4 April 2007 21:34
Subject: Re: [lm-sensors] sensors-detect path issue under fc5 / 6 -- fix included.

Quoted 29 lines · Jean Delvare
Quoted 28 lines · Vince Spinelli
Quoted 5 lines

It's a simple one, but it's worth noting.

I'm unawares of other distributions, but under Fedora Core 5 and 6, the i2cdetect command is located in the /usr/sbin directory, not /sbin/ nor /usr/local/sbin.

That's the case of pretty much all distributions shipping lm-sensors, as /usr/local is meant for things added on top of the original distribution.

Quoted 2 lines

As a result, an error message is encountered when running sensors-detect.sh as either root, sudo root, or a normal user.

There's no such thing as "sensors-detect.sh" in our source package. sensors-detect is a perl script.

If your root user doesn't have /usr/sbin in its $PATH, then your setup is seriously broken, I doubt sensors-detect will be the only failing tool.

sensors-detect can no longer be run as non-root, so this case doesn't matter.

The su/sudo case is more problematic though, I can imagine a standard user gaining root permissions without getting the $PATH usually associated with the root user.

Quoted 15 lines
Quoted 3 lines
Quoted 3 lines

The fix is as follows... inside of the sensors-detect.sh script, there's a
segment to add directories to path.

I've made a functionally equivalent change to sensors-detect, committed to our SVN repository. Feel free to give it a try. Hopefully it will make the packagers happier.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors