Opened 11 years ago

Closed 8 years ago

#546 closed patch (fixed)

IZ2656: Fix to support JAVA_HOME discovery on alternatives-based systems

Reported by: paulmillar Owned by:
Priority: normal Milestone:
Component: sge Version: current
Severity: minor Keywords: build
Cc:

Description

[Imported from gridengine issuezilla http://gridengine.sunsource.net/issues/show_bug.cgi?id=2656]

        Issue #:      2656             Platform:     All       Reporter: paulmillar (paulmillar)
       Component:     gridengine          OS:        All
     Subcomponent:    build            Version:      current      CC:    None defined
        Status:       NEW              Priority:     P3
      Resolution:                     Issue type:    PATCH
                                   Target milestone: ---
      Assigned to:    andreas (andreas)
      QA Contact:     andreas
          URL:
       * Summary:     Fix to support JAVA_HOME discovery on alternatives-based systems
   Status whiteboard:
      Attachments:
                      Date/filename:                                        Description:                                                                                      Submitted by:
                      Mon Jul 14 16:05:00 -0700 2008: fix-alternatives.diff Proposed patch to fix JAVA_HOME discovery on alternatives- (sym-link-) based systems (text/plain) paulmillar

     Issue 2656 blocks:
   Votes for issue 2656:


   Opened: Mon Jul 14 16:02:00 -0700 2008 
------------------------


Alternatives is a system that allows fine-grain control over which of different
(competing) applications to use for some particular activity.  This is achieved
by casting the command (typically /usr/bin/<cmd>) as a sym-link into a suitably
named file in /etc/alternatives/ directory, which is (itself) a sym-link to the
specific application; for example, /usr/bin/java is a sym-link to
/etc/alternatives/java, which might be a sym-link to
/usr/lib/jvm/java-6-sun/jre/bin/java.

When guessing a value for JAVA_HOME on alternatives-based systems, the current
aimk.site doesn't fare well.  It assumes a JAVA_HOME of /usr, which leads to
interesting build failures (as -I/usr/include/linux becomes appended to the
compilation flags).

The proposed patch fixes this by testing whether the java binary in the user's
path is a sym-link.  If so, following the sym-link to discover the actual
location of the JDK.

Cheers,

Paul.

Index: aimk.site
===================================================================
RCS file: /cvs/gridengine/source/aimk.site,v
retrieving revision 1.66
diff -u -r1.66 aimk.site
--- aimk.site   3 Jul 2008 15:14:14 -0000       1.66
+++ aimk.site   14 Jul 2008 23:01:49 -0000
@@ -157,6 +157,11 @@
 if ( ! $?JAVA_HOME ) then
    set JAVA_BIN = `which \java`

+   # Resolve any symbolic links to find true absolute path to the executable.
+   if ( -l "$JAVA_BIN" ) then
+       set JAVA_BIN = `readlink -f /usr/bin/java`
+   endif
+
    if ( -e "$JAVA_BIN" ) then
       set JAVAV = `$JAVA_BIN -version |& head -1`
       set JAVAV = `expr "$JAVAV" : 'java version "1\.\([0-9]\).*"'`

   ------- Additional comments from paulmillar Mon Jul 14 16:05:15 -0700 2008 -------
Created an attachment (id=179)
Proposed patch to fix JAVA_HOME discovery on alternatives- (sym-link-) based systems

Attachments (1)

179 (673 bytes) - added by dlove 8 years ago.

Download all attachments as: .zip

Change History (2)

comment:1 Changed 8 years ago by dlove

  • Resolution set to fixed
  • Severity set to minor
  • Status changed from new to closed

Fixed by [3588/sge].

Changed 8 years ago by dlove

Note: See TracTickets for help on using tickets.