Bug 115443 - net-mgmt/nagios-plugins - incorrect library path in perl based nagios-plugins
Summary: net-mgmt/nagios-plugins - incorrect library path in perl based nagios-plugins
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Rong-En Fan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-12 13:20 UTC by Stefan Kaltenbrunner
Modified: 2007-10-08 06:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Kaltenbrunner 2007-08-12 13:20:01 UTC
installing the net-mgmt/nagios-plugins results in all the perl based plugins to be broken in the same way:

# /usr/local/libexec/nagios/check_mailq -h
Can't locate utils.pm in @INC (@INC contains: nagios /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at /usr/local/libexec/nagios/check_mailq line 36.
BEGIN failed--compilation aborted at /usr/local/libexec/nagios/check_mailq line 36.

Fix: 

the problem is caused by incorrect/missing substitution of the path to the perl module utils.pm at build time.

simply changing:

use lib  "nagios";

to

use lib "/usr/local/libexec/nagios";

in each of the affected plugins solves the problem.
How-To-Repeat: simply install the net-mgmt/nagios-plugins and try to use one of the perl (not C) based plugins
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-09-08 13:48:59 UTC
State Changed
From-To: open->closed

I'm sorry, but I've had to axe the net-mgmt/netsaint and 
net-mgmt/netsaint-plugins ports. 

Please migrate to net-mgmt/nagios since that one is still being 
developed.
Comment 2 Stefan Kaltenbrunner 2007-09-08 14:19:03 UTC
edwin@FreeBSD.org wrote:
> Synopsis: net-mgmt/netsaint-plugins - incorrect library path in perl based nagios-plugins
> 
> State-Changed-From-To: open->closed
> State-Changed-By: edwin
> State-Changed-When: Sat Sep 8 12:48:59 UTC 2007
> State-Changed-Why: 
> I'm sorry, but I've had to axe the net-mgmt/netsaint and
> net-mgmt/netsaint-plugins ports.
> 
> Please migrate to net-mgmt/nagios since that one is still being
> developed.

I'm actually using net-mgmt/nagios-plugins here - my usage of
"netsaint-plugins" was incorrect. the current version of
net-mgmt/nagios-plugins still has the same problem:

nagios-plugins-1.4.9_1,1 Plugins for Nagios

# /usr/local/libexec/nagios/check_mailq --help
Can't locate utils.pm in @INC (@INC contains: nagios
/usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at
/usr/local/libexec/nagios/check_mailq line 36.
BEGIN failed--compilation aborted at
/usr/local/libexec/nagios/check_mailq line 36.


Stefan
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2007-09-09 01:43:03 UTC
State Changed
From-To: closed->open

Reopen after submitter made it clear it was nagios-plugins he mentioed.
Comment 4 Rong-En Fan freebsd_committer freebsd_triage 2007-09-23 09:47:25 UTC
State Changed
From-To: open->feedback

Dear submitter, 

With fresh installation of nagios-plugins-1.4.9_1,1, the library 
path in perl based scripts is correct.  If this still does not work 
for you, please provide me and maintainer in more details. Thanks. 


Comment 5 Rong-En Fan freebsd_committer freebsd_triage 2007-09-23 09:47:25 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rafan

I'll take it.
Comment 6 Rong-En Fan freebsd_committer freebsd_triage 2007-09-30 07:33:10 UTC
Propose this patch.

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nagios-plugins/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- Makefile	30 Sep 2007 04:47:19 -0000	1.63
+++ Makefile	30 Sep 2007 06:29:05 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	nagios-plugins
 PORTVERSION=	1.4.9
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE_EXTENDED}
Index: files/patch-plugins-scripts__subst.in
===================================================================
RCS file: files/patch-plugins-scripts__subst.in
diff -N files/patch-plugins-scripts__subst.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-plugins-scripts__subst.in	30 Sep 2007 06:29:05 -0000
@@ -0,0 +1,13 @@
+--- plugins-scripts/subst.in.orig	Sun Sep 30 14:23:17 2007
++++ plugins-scripts/subst.in	Sun Sep 30 14:26:28 2007
+@@ -62,8 +62,8 @@
+ # subst will replace the fully qualified command with whatever is
+ # returned from the which subroutine
+ #
+-/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// {
+-	match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/);
++/^[^#]/ && /(\/.*)?\/(bin|sbin)\// {
++	match($0,/(\/.*)?\/(bin|sbin)\/[-_a-zA-Z0-9]+/);
+ 	c=substr($0,RSTART,RLENGTH);
+ 	sub(c,which(c,path));
+ }
Comment 7 dfilter service freebsd_committer freebsd_triage 2007-10-08 05:15:09 UTC
rafan       2007-10-08 04:14:54 UTC

  FreeBSD ports repository

  Modified files:
    net-mgmt/nagios-plugins Makefile 
  Added files:
    net-mgmt/nagios-plugins/files patch-plugins-scripts__subst.in 
  Log:
  - When libexecdir does not exist, the installed perl based plugins gets wrong
    use lib directive. This is due to the installation procedure assumes
    the existence of libexecdir. Fix this problem and bump PORTREVISION.
  
  PR:             ports/115443
  Reported by:    Stefan Kaltenbrunner <stefan at kaltenbrunner.cc>
  Patched by:     Jarrod Sayers <jarrod at netleader.com.au> (maintainer)
  
  Revision  Changes    Path
  1.64      +1 -1      ports/net-mgmt/nagios-plugins/Makefile
  1.1       +11 -0     ports/net-mgmt/nagios-plugins/files/patch-plugins-scripts__subst.in (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 8 Rong-En Fan freebsd_committer freebsd_triage 2007-10-08 05:15:12 UTC
State Changed
From-To: feedback->closed

Fixed by maintainer's patch via private mail. Thanks.
Comment 9 Rong-En Fan freebsd_committer freebsd_triage 2007-10-08 06:34:25 UTC
State Changed
From-To: closed->feedback

Changed to feedback again to trick gnats.
Comment 10 Rong-En Fan freebsd_committer freebsd_triage 2007-10-08 06:34:59 UTC
State Changed
From-To: feedback->closed

Close this again.