[Nagiosplug-devel] subst.in patch
Phil Dibowitz
phil at ipom.com
Tue Aug 30 08:34:07 CEST 2005
Ton Voon wrote:
> 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));
> }
I'm not sure what this proves - my debugging showed I always got there
as well.
> 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.
Ah. In that case the script is still in error, but not completely in the
way I thought it was. It's checking for things that may nto be in
libexec - great for grep. But if it doesn't find it, it gives it a
relative path, and that's an *incorrect* action. In this case which()
should return whatever it was sent.
In theory, I don't think the "use" lines should be passed through the
"which" functions at all.... since "which utils.pm" or "which
/usr/lib/nagios/plugins" never makes sense anyway...
One of those two needs to be remedied.
> 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.
The chroot has all the basics... it's just using mach(1) to build and
tear it down each time to ensure it's always identical.
> 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.
I think the patch is over-zealous, but a fix is still needed as
described above.
> 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.
Agreed, but in the short term, I think which() should be fixed to never
replace "/usr/lib/nagios/plugins" whith "nagios/plugins" because that's
never a good thing.
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20050830/6d2b3412/attachment.sig>
More information about the Devel
mailing list