Bug 250535

Summary: improve perldap script execution ability on bundled platforms
Product: [Retired] 389 Reporter: Rich Megginson <rmeggins>
Component: Command Line UtilitiesAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Chandrasekar Kannan <ckannan>
Severity: high Docs Contact:
Priority: high    
Version: 1.1.0betaCC: benl, jgalipea, nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 23:00:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 249650, 493682    
Attachments:
Description Flags
diffs for ldapserver
none
diffs for adminserver
none
cvs commit log (Comment #1)
none
cvs commit log (Comment #2) none

Description Rich Megginson 2007-08-02 03:44:15 UTC
On bundled platforms, you have to jump through hoops to set the correct
environment variables to run perldap scripts.  Especially the setup scripts. 
The user should not have to set PATH, PERL5LIB, and LD_LIBRARY_PATH to run these
scripts.

Comment 1 Rich Megginson 2007-08-02 03:44:16 UTC
Created attachment 160494 [details]
diffs for ldapserver

Comment 2 Rich Megginson 2007-08-02 03:45:05 UTC
Created attachment 160495 [details]
diffs for adminserver

Comment 3 Nathan Kinder 2007-08-02 05:43:34 UTC
Your changes look good.

Comment 4 Rich Megginson 2007-08-02 14:40:33 UTC
Created attachment 160525 [details]
cvs commit log (Comment #1)

Reviewed by: nkinder (Thanks!)
Files: see diff
Branch: HEAD
Fix Description: Most platforms will just use perl from PATH.  However, on
Solaris and HP-UX, we have to use special 64 bit versions to execute perldap,
since perldap is 64 bit on those platforms.  Also, if bundling all of the
dependent components into the single package, we need to make sure the perl
library path is set correctly to find perldap.
The last step will be to build our version of perldap on the bundled platforms
to use rpath to point to the correct runtime library location.
Platforms tested: RHEL4, HP-UX 11.23 IPF 64 bit
Flag Day: no
Doc impact: no

Comment 5 Rich Megginson 2007-08-02 14:44:45 UTC
Created attachment 160526 [details]
cvs commit log (Comment #2)

Comment 6 Nathan Kinder 2007-12-21 21:16:58 UTC
Verified that scripts that use PerLDAP, such as migrate-ds.pl, are able to find
all of their Perl modules properly on HP-UX.  I also looked at the paths inside
of these scripts to make sure they look correct.

I found that the repl-monitor.pl script still has a problem however.  If I run
it from the command line using it's wrapper, it is unable to find PerLDAP.  It
isn't setting the perl libpath anywhere, so it's not looking in
/opt/dirsrv/lib/perl.  I also see this problem if I invoke repl-monitor-cgi.pl
from the command line.  If I add a "use lib" line as this bug added to the other
perl scripts, everything works fine.

Comment 7 Nathan Kinder 2007-12-21 21:26:18 UTC
There is also a problem on Solaris.  We are using perl from the environment in
repl-monitor.pl, but we need to be using perl from RHATperlx
(/opt/perl5x/bin/perl) for PerLDAP to be found.

Comment 8 Nathan Kinder 2007-12-21 21:48:01 UTC
If we move repl-monitor.pl to repl-monitor.pl.in in the source tree and make the
following modification, it should solve both issues.

Index: repl-monitor.pl
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/repl-monitor.pl,v
retrieving revision 1.2
diff -u -5 -t -r1.2 repl-monitor.pl
--- repl-monitor.pl     5 Sep 2007 16:35:28 -0000       1.2
+++ repl-monitor.pl     21 Dec 2007 21:44:57 -0000
@@ -1,6 +1,6 @@
-#!/usr/bin/env perl
+#!@perlexec@
 # BEGIN COPYRIGHT BLOCK
 # This Program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free Software
 # Foundation; version 2 of the License.
 #
@@ -154,10 +154,12 @@
 # installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
 # this script is always invoked by repl-monitor-cgi.pl, which sets all of these
 # If using this script standalone, be sure to set the shared lib path and
 # the path to the perldap modules.

+use lib qw(@perlpath@);
+
 $usage = "\nusage: $0 -f configuration-file [-h host] [-p port] [-r] [-u
refresh-url] [-t refresh-interval]\n\nor   : $0 -v\n";

 use Getopt::Std;                # parse command line arguments
 use Mozilla::LDAP::Conn;        # LDAP module for Perl
 use Mozilla::LDAP::Utils qw(normalizeDN);       # LULU, utilities.

Comment 9 Rich Megginson 2007-12-21 21:58:59 UTC
(In reply to comment #8)

Looks good.

Comment 12 Nathan Kinder 2008-12-12 20:12:31 UTC
(In reply to comment #9)
> 
> Looks good.

I'd like to get another ack since it's been a year since you last approved this...

Comment 13 Rich Megginson 2008-12-12 20:31:32 UTC
re-ack

Comment 14 Nathan Kinder 2008-12-12 20:36:32 UTC
Checked into ldapserver (HEAD).  Thanks to Rich for his review(s)!

Removing repl-monitor.pl;
/cvs/dirsec/ldapserver/ldap/admin/src/scripts/repl-monitor.pl,v  <--  repl-monitor.pl
new revision: delete; previous revision: 1.2
done
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/repl-monitor.pl.in,v
done
Checking in repl-monitor.pl.in;
/cvs/dirsec/ldapserver/ldap/admin/src/scripts/repl-monitor.pl.in,v  <--  repl-monitor.pl.in
initial revision: 1.1
done

Comment 15 Jenny Severance 2009-03-30 19:41:40 UTC
Is this something QE can verify?  If so, please add steps to verify.

Comment 16 Rich Megginson 2009-03-30 19:55:19 UTC
The fix is that you can run setup-ds-admin.pl and the other perl scripts without having to first set PATH or LD_LIBRARY_PATH or PERL5LIB to point to the right perl, libs, and perl modules directories.  And this should work on linux, solaris, and hp-ux.

Comment 17 Jenny Severance 2009-04-09 19:51:22 UTC
fix verified DS 8.1, no need to set PATH before executing setup-ds-admin.pl, also tested db2ldif, fixup-memberof

Comment 18 Chandrasekar Kannan 2009-04-29 23:00:51 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0455.html