Package: eclipse-platform-common
Version: 3.1.1-7
Severity: normal
Tags: patch

There is a small bug in eclipse starter script : "export JAVA_HOME" is
done inside a "while" loop. But shell is tricky: the while actually creates
a subprocess, so since the export is done there, it doesn't impact the
rest of the script. Thus JAVA_HOME will remain unset.

Result is this (if JAVA_HOME is not set elsewhere):
+ '[' -z '' ']'
+ echo 'searching for compatible vm...'
searching for compatible vm...
+ cat /etc/eclipse/java_home
+ grep -v '^#'
+ grep -v '^$'
+ read JAVA_HOME
+ echo -n '  testing /usr/lib/j2sdk1.5-sun...'
  testing /usr/lib/j2sdk1.5-sun...+ '[' -x
/usr/lib/j2sdk1.5-sun/bin/java ']'
+ export JAVA_HOME
+ echo found
found
+ break

# If we don't have a JAVA_HOME yet, we're doomed.
if [ -z "${JAVA_HOME}" ]; then
    zenity \
        --error \
        --title="Could not launch Eclipse Platform" \
        --text="A suitable Java Virtual Machine for running the Eclipse
Platform could not be located."
    exit 1
fi
+ '[' -z '' ']'
+ zenity --error '--title=Could not launch Eclipse Platform' '--text=A
suitable Java Virtual Machine for running the Eclipse Platform could not
be located.'
+ exit 1



A simple fix is to replace the 'while' loop by a 'for' loop:

--- /usr/bin/eclipse.orig       2006-01-06 15:31:34.000000000 +0100
+++ /usr/bin/eclipse    2006-01-06 15:32:19.000000000 +0100
@@ -65,8 +65,8 @@
 # and pick the first one that exists.
 if [ -z "${JAVA_HOME}" ]; then
     echo "searching for compatible vm..."
-    cat /etc/eclipse/java_home | grep -v '^#' | grep -v '^$' | \
-    while read JAVA_HOME; do
+    for JAVA_HOME in $(cat /etc/eclipse/java_home | grep -v '^#' | grep
-v '^$' );
+    do
         echo -n "  testing ${JAVA_HOME}..."
         if [ -x "${JAVA_HOME}/bin/java" ]; then
             export JAVA_HOME

(This won't work if some path contain a space)


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-nitro2
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages eclipse-platform-common depends on:
ii  gij-4.0 [java1-runtime]   4.0.2-6        The GNU Java bytecode interpreter
ii  java-common               0.23           Base of all Java packages
ii  java-gcj-compat           1.0.47-1       Java runtime environment using
GIJ
ii  sun-j2sdk1.5 [java-common 1.5.0+update05 Java(TM) 2 SDK, Standard Edition,
ii  zenity                    2.12.1-1       Display graphical dialog boxes
fro

eclipse-platform-common recommends no packages.

-- no debconf information



Reply via email to