Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 May 2012 14:13:31 GMT
From:      Alfred Bartsch <bartsch@dssgmbh.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/167799: javavmwrapper-2.3.5 does not always choose the right java vm
Message-ID:  <201205111413.q4BEDVve094631@red.freebsd.org>
Resent-Message-ID: <201205111420.q4BEKC24060910@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167799
>Category:       ports
>Synopsis:       javavmwrapper-2.3.5 does not always choose the right java vm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 11 14:20:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Alfred Bartsch
>Release:        FreeBSD 8.3-stable
>Organization:
Data-Service GmbH
>Environment:
FreeBSD pcadmin.incore 8.3-STABLE FreeBSD 8.3-STABLE #0: Tue May  8 16:15:10 CEST 2012     root@pcadmin.incore:/usr/obj/usr/src/sys/PCADMIN  i386
>Description:
javavmwrapper behaves differently, whether it sees an installed portstree or not.
At runtime it should not make any difference in behavior, whether a portstree is installed / mounted from anywhere or not.
This is primarily a problem, if javavmwrapper runs on another machine than it was built on, or the portstree has changed after building. Changing some java settings in /etc/make.conf may also influence the javavm choice. 
javavmwrapper should rely only on /usr/local/etc/javavms and /usr/local/etc/javavm_opts.conf while choosing the "right" java vm.

>How-To-Repeat:
install both diablo-jdk and openjdk.
configure javavmwrapper to prefer openjdk.
run "java -version" with portstree in /usr/ports -> diablo-jdk is chosen
move (temporarily) /usr/ports  anywhere
run "java -version" again                        - openjdk is chosen
>Fix:
Responsible for this unwanted behavior are a couple of lines in javavm shell script which can be simply removed:
--- javavm.orig 2011-09-30 04:40:51.000000000 +0200
+++ javavm      2012-05-11 09:07:53.000000000 +0200
@@ -493,30 +493,6 @@
 
     unset JAVA_HOME
 
-    # Determine location of bsd.port.mk if it exists
-    _JAVAVM_PORTSDIR=
-    if [ -r /usr/share/mk/bsd.port.mk ]; then
-        _JAVAVM_PORTSDIR=`"${_JAVAVM_MAKE}" -f /usr/share/mk/bsd.port.mk -V PORTSDIR 2>/dev/null`
-    fi
-
-    _JAVAVM_BSD_PORT_MK=
-    if [ -n "${_JAVAVM_PORTSDIR}" -a -r "${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk" ]; then
-        _JAVAVM_BSD_PORT_MK="${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk"
-    fi
-
-    # If bsd.port.mk was found, use that to determine the VM to use.
-    if [ -n "${_JAVAVM_BSD_PORT_MK}" ]; then
-        JAVA_HOME=`"${_JAVAVM_MAKE}" -f "${_JAVAVM_BSD_PORT_MK}" -V JAVA_HOME USE_JAVA=yes 2>/dev/null`
-        if [ -n "${JAVA_HOME}" -a -f "${JAVA_HOME}/bin/${_JAVAVM_PROG}" ]; then
-            _JAVAVM_PROG_PATH="${JAVA_HOME}/bin"
-            return 0
-        elif [ -n "${JAVA_HOME}" -a \
-               -f "${JAVA_HOME}/jre/bin/${_JAVAVM_PROG}" ]; then
-            _JAVAVM_PROG_PATH="${JAVA_HOME}/jre/bin"
-            return 0
-        fi
-    fi
-
     # Then try to make sure that ${_JAVAVM_CONF} exists
     if [ ! -e "${_JAVAVM_CONF}" ]; then
         echo "${_JAVAVM_PROG}: error: can't find ${_JAVAVM_CONF} configuration file" 1>&2


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205111413.q4BEDVve094631>