[Nagiosplug-devel] [ nagiosplug-Patches-2722832 ] awk subst.in/subst script path error

SourceForge.net noreply at sourceforge.net
Wed May 20 06:44:27 CEST 2009


Patches item #2722832, was opened at 2009-03-31 00:01
Message generated for change (Comment added) made by dermoth
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2722832&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Martin Foster (martinfoster)
Assigned to: Thomas Guyot-Sionnest (dermoth)
Summary: awk subst.in/subst script path error

Initial Comment:
the plugins-scripts/subst.in awk script's last stage is to replace references to fully qualified commands with whatever is returned from the path subroutine.

This can trap the path derived by led() to update the  "use lib " statement at the top of scripts.  eg:
 use lib "/usr/lib/nagios/plugins";

gets updated to:
 use lib "nagios/plugins";

the second isn't valid.  I perceive the command line substitution as a cosmetic optimization, there's nothing wrong with calling commands explicitly.  They should be properly discovered by the configure stage for a given platform/distribution anyways.

patch knocks out the substitution.  May be more elegant ways to accomplish the same goal.


----------------------------------------------------------------------

>Comment By: Thomas Guyot-Sionnest (dermoth)
Date: 2009-05-20 00:44

Message:
Thanks! Fixed in Git

----------------------------------------------------------------------

Comment By: Martin Foster (martinfoster)
Date: 2009-04-01 21:02

Message:
yup - that appears to work.

Change paths for execs first, then change lib path.  Original 'use lib
".";' won't catch.

See updated nagios-plugins-subst.patch, should also obsolete the debian
patch.


----------------------------------------------------------------------

Comment By: Martin Foster (martinfoster)
Date: 2009-04-01 20:48

Message:
running the exec path substitution prior to updating INC with the libexec
dir appears to accomplish fixing up the script for non-standard paths,
while not harming libexec dirs that are under /usr/lib or any other
detected executable hosting directory.

Will test a bit more & submit updated patch


----------------------------------------------------------------------

Comment By: Martin Foster (martinfoster)
Date: 2009-04-01 20:40

Message:
Hi, I'm taking a closer look at this now that I get why it's there.

first things first:
./configure --prefix=/usr --exec-prefix=/usr
--libexecdir=/usr/lib/nagios/plugins --sysconfdir=/etc/nagios
--datadir=/usr/share --with-cgiurl=/nagios/cgi-bin

so the plugins are installed to /usr/lib/nagios/plugins

I note that this is the same path used by Debian, so I went to check what
their package does. They apply a patch that explicitly sets the paths in
subst -  then removes the substitution wholesale, the led() function, and
removes the which() function. see attached as a reference.



----------------------------------------------------------------------

Comment By: Thomas Guyot-Sionnest (dermoth)
Date: 2009-03-31 07:03

Message:
Uhg sorry I might have been too wuick on the trigger.

Looks like this is a "automatic configuration" thingy - i.e. instead of
detecting commands in configure it does it at the make phase using this
script.

What it you move that up in the script, so that this substition happens
before the lib expansion?

A better way of doing it is making an explicit keyword in the paths, and
matching the keyword in that block. I.e. substituting "NP_AUTO_PATH/echo"
to the result of `which echo` That would require finding all paths modified
by running the said part of the script and comparing source plugins with
generated files.


----------------------------------------------------------------------

Comment By: Thomas Guyot-Sionnest (dermoth)
Date: 2009-03-31 06:52

Message:
Thanks for reporting this, though your patch is wrong. These substitutions
are required for non-standard paths.

What configure options did you use, so I can try to reproduce it?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2722832&group_id=29880




More information about the Devel mailing list