bug in startup script of package eclipse

Jelle Boomstra jelle.boomstra at gmail.com
Sun Jan 18 21:08:02 UTC 2009


Hi all,

the eclipse package contains a startup script that contains some errors that 
do not match up with the way things are done Ubuntu (or debian) AFAIK.

this is the part where it broke after installing eclipse:

[...]
# If the user has not set JAVA_HOME, cycle through our list of compatible VM's
# and pick the first one that exists.
if [ -z "${JAVA_HOME}" -a ! -n "${JAVACMD}" ]; then
    echo "searching for compatible vm..."
    javahomelist=`cat /etc/eclipse/java_home  | grep -v '^#' | grep -v '^$' | 
while read line ; do echo -n $line ; echo -n ":" ; done`
    OFS="$IFS"
    IFS=":"
    for JAVA_HOME in $javahomelist ; do
        echo -n "  testing ${JAVA_HOME}..."
        if [ -x "${JAVA_HOME}/bin/java" ]; then
            export JAVA_HOME
            echo "found"
            break
        else
            echo "not found"
        fi
    done
    IFS="$OFS"
fi
[...]

this goes wrong as java is handled by the alternatives system, and a 
placeholder script lives in /usr/bin/java. The deb package should have a 
suitable java as requirement and just use the default java. A test like this 
one at runtime is too late and solves no problems.
The java version i use is: 
OpenJDK  Runtime Environment (build 1.6.0_0-b11)
OpenJDK Client VM (build 1.6.0_0-b11, mixed mode)

A further possible problem might be this piece of code some way down:

[...]
EXT=/usr/local/lib/eclipse/.eclipseextension
if [ ! -f $EXT ]; then
    if ! touch $EXT 2>/dev/null; then
        cat <<-EOF
        Could not create $EXT. Please run as root:
            touch $EXT
            chmod 2775 $EXT
            chown root:staff $EXT
        EOF
    fi
    chmod 2775 $EXT 2> /dev/null || true
    chown root:staff $EXT 2> /dev/null || true
fi
[...]
This is just plain silly. A script intended to be run by mortal users should 
not try to write to this location. The package should create or provide such 
a file a install, if it is needed at all.

I have attached a modified version that appears to work for me. I leave it to 
the package maintainer to modify the install requirements.




-- 
With kind regards,
Jelle Boomstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eclipse
Type: application/x-shellscript
Size: 4754 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090118/5f5a343c/attachment.bin>


More information about the ubuntu-users mailing list