[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pki-devel] Wrapper script for Java programs and usage of LD_LIBRARY_PATH



On 17/04/15 20:09, David Sommerseth wrote:
> 
> Hi,
> 
> I've started looking at RHBZ #1211638 [1] on behalf of the secondary
> architectures team.  There are some issues related to /usr/bin/AtoB
> and /usr/bin/BtoA on ppc64 and ppc64le - due to the hard coding of
> platform and architecture dependencies.
> 
> From what I understand, these scripts found in /usr/bin are generated
> by the base/java-tools/templates/pki_java_command_wrapper.in template.
> 
> Currently, I only focus on what is inside the Linux OS block.
> 
> From what I can understand, the Linux block only sets up the
> LD_LIBRARY_PATH and I wonder why it does that?  I know in earlier days
> (10-15 years ago) such tweaks where needed when ld.so.conf wasn't
> updated properly or had issues loading the proper libraries.  But is
> that an issue today at all on Linux?
> 
> I would like to propose a patch which cleans up this behaviour.  If it
> is believed that LD_LIBRARY_PATH is still needed, I will of course
> respect that.  But I'd like to simplify this whole code block to be
> less "architecture dependent".  Like just using the x86_64
> LD_LIBRARY_PATH setup for all arches.  The general idea is to not need
> to care about the $ARCHITECTURE variable at all inside the Linux block.
> 
> Any thoughts or comments?  I've done some simple tests on Fedora 21
> (x86_64) stripping out the complete LD_LIBRARY_PATH stuff in AtoB and
> BtoA.  Everything worked just fine.

Just to be more concrete, I've added two patches solving the same
problem, just two different approaches.

0001-Simplify-the-architectures-on-Linux-in-the-java-wrap.patch keeps
the LD_LIBRARY_PATH stuff, but uses generic system paths regardless of
which architecture it is running on.

0001-Cleanup-LD_LIBRARY_PATH-usage-in-pki_java_command_wr.patch removes
the whole LD_LIBRARY_PATH stuff.

Again, the changes are isolated to Linux only.  I have no idea how this
behaves on SunOS/Solaris.  Both patches have been smoke-tested
successfully using AtoB and BtoA on Fedora 21 (x86_64).


--
kind regards,

David Sommerseth
From 485986b71ed97f43afaf7163fa27c2f3c673b068 Mon Sep 17 00:00:00 2001
From: David Sommerseth <davids redhat com>
Date: Fri, 17 Apr 2015 20:40:16 +0200
Subject: [PATCH] Simplify the architectures on Linux in the java wrapper
 script

When installing pki-tools on an "unexpected" platform, the wrapper script
will bail out claiming it is not possible to run this script on that
platform.  The only thing which is prepared on Linux in these wrapper
scripts is the LD_LIBRARY_PATH enviroment variable.

To remove the need of maintaining a list of supported architectures,
this patch simplifies the LD_LIBRARY_PATH setup by providing a value
which is generic for all Linux architectures.

Signed-off-by: David Sommerseth <davids redhat com>
---
 .../templates/pki_java_command_wrapper.in          | 23 +++++-----------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/base/java-tools/templates/pki_java_command_wrapper.in b/base/java-tools/templates/pki_java_command_wrapper.in
index 09e059e..b7d60c3 100644
--- a/base/java-tools/templates/pki_java_command_wrapper.in
+++ b/base/java-tools/templates/pki_java_command_wrapper.in
@@ -71,24 +71,11 @@ if [ "${OS}" = "Linux" ] ; then
     JAVA="java"
     JAVA_OPTIONS=""
 
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "armv7l" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
+    LD_LIBRARY_PATH=/usr/lib:/lib
+    LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
+    LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
+    LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
+    export LD_LIBRARY_PATH
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
-- 
1.8.3.1

From 0bc1afcdc71279d1ccd68e0d294cc53c1195bfe0 Mon Sep 17 00:00:00 2001
From: David Sommerseth <davids redhat com>
Date: Fri, 17 Apr 2015 20:13:08 +0200
Subject: [PATCH] Cleanup LD_LIBRARY_PATH usage in pki_java_command_wrapper.in
 on Linux

It is believed that there is no need to explicitly set LD_LIBRARY_PATH
on Linux, especially not when all these paths are default system paths.

This resolves an issue related to support of a broader set of CPU
architectures.  Otherwise all new architectures needs similar hard-coded
paths.

For more information, see Red Hat bugzilla #1211638
https://bugzilla.redhat.com/show_bug.cgi?id=1211638

Signed-off-by: David Sommerseth <davids redhat com>
---
 base/java-tools/templates/pki_java_command_wrapper.in | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/base/java-tools/templates/pki_java_command_wrapper.in b/base/java-tools/templates/pki_java_command_wrapper.in
index 09e059e..404bcf0 100644
--- a/base/java-tools/templates/pki_java_command_wrapper.in
+++ b/base/java-tools/templates/pki_java_command_wrapper.in
@@ -70,25 +70,6 @@ if [ "${OS}" = "Linux" ] ; then
     ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
-
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "armv7l" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]