[Nagiosplug-devel] subst.in patch
Ton Voon
tonvoon at mac.com
Tue Aug 30 04:56:13 CEST 2005
Phil,
I've been taking a look at this. I could not recreate your problem. I
ran a ./configure with /usr/local/nagios/libexec in existence and
then ran a ./configure after rm -r /usr/local/nagios and all the
substitutions for the perl scripts in plugins-scripts were the same.
There is a specific part of subst.in which says:
# used to replace "use lib utils.pm" with "use lib @libexecdir"
#
function led() {
led1 = "@libexecdir@";
So I think your diagnosis is wrong: the libexecdir is being taken
from the configure script and passing through to subst.in correctly.
I put a debugging line into the main awk loop here:
# Specific programs
#
/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// {
print STDERR "Got here!!!: "$0;
#match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/);
#start=RSTART+RLENGTH;
#c=substr($0,RSTART,RLENGTH);
#sub(c,which(c,path));
}
and then ran a make clean; make in the plugins-script directory. I
think what is happening is that it is trying to find any programs
that are fully prefixed and amending them to possible changes in the
PATH.
Eg, check_log.in has GREP="/bin/grep", but after running make
check_log, it replaces that line with GREP="/usr/bin/grep", which is
the location of grep on my MacOSX system.
You mentioned something about building the plugins in a chroot
environment. My guess is that your chroot is missing a lot of these
commands, and thus the substitutions are failing.
So I am going to reject your patch because it looks like there is
specific functionality the which routine is providing, even though it
is failing in your specialised case. However, I will try and make the
comments more informative.
Long term, the substitutions shouldn't be done at compile time, but
should be done at configure time instead. However, this will be a
tougher job to sort out. I welcome any patches in this area.
Ton
On 19 Aug 2005, at 07:52, Phil Dibowitz wrote:
> I recently submitted a patch:
>
> https://sourceforge.net/tracker/index.php?
> func=detail&aid=1262777&group_id=29880&atid=397599
>
> which removes the which() function and the call to it from the
> plugins-scripts/subst.in awk script.
>
> The problem is that this function checks to see if $libexec exists
> (where the plugins would go, and thus the utils.pm), and if it doesn't
> it changes the "use lib" lines in the perl plugins to remove the
> base of
> $libexec from the path (changes /usr/lib/nagios/plugins/ to
> nagios/plugins).
>
> But... it's checking for the existance of a directory and making a
> decision based on it not being there even though
> _it's_about_to_make_it_! That's silly.
>
> The result is that... if you have a previous install, your 'use lib'
> lines are good and nrpe can execute your plugins just fine.
>
> But if it's a fresh install, your plugins get the relative paths which
> mean that nrpe can't execute them at all, and nor can anything else
> that
> doesn't run from within /usr/lib.
>
> I can find no logical use for this function, and things are working
> well
> for us with the patch...
>
> Any reasons for this that I've missed?
>
> --
> Phil Dibowitz phil at ipom.com
> Freeware and Technical Pages Insanity Palace of Metallica
> http://www.phildev.net/ http://www.ipom.com/
>
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety."
> - Benjamin Franklin, 1759
>
>
More information about the Devel
mailing list