You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bigtop.apache.org by "Sean Mackrory (JIRA)" <ji...@apache.org> on 2013/07/01 17:31:20 UTC

[jira] [Commented] (BIGTOP-1011) bigtop-detect-javahome has a quirky search order

    [ https://issues.apache.org/jira/browse/BIGTOP-1011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13696883#comment-13696883 ] 

Sean Mackrory commented on BIGTOP-1011:
---------------------------------------

{quote}
Took a brief look, I don't think you meant to do "echo $candidate"
Also, you probably want to break out of the for loop or do something similar.
{quote}

Thanks for reviewing, Mark. The echo's presence and the break's absence were for testing which JDKs get detected, but both have been fixed.

{quote}
This JIRA raises some important questions. While I haven't really gotten a chance to think fully think about the pros and cons, I am tending to agree that prioritizing defaults may not be the best thing to do.
{quote}

Correctly prioritized defaults are better than incorrectly prioritized defaults, but if you're suggesting that we should get people to explicitly set JAVA_HOME, then I absolutely agree. Since other packages can drag in JDK dependencies, a routine upgrade or installation can slip a different JDK in front of the one intended for Bigtop. It bothers me when serious users do not have this set, and I think we should do something to make that process a more obvious step.
                
> bigtop-detect-javahome has a quirky search order
> ------------------------------------------------
>
>                 Key: BIGTOP-1011
>                 URL: https://issues.apache.org/jira/browse/BIGTOP-1011
>             Project: Bigtop
>          Issue Type: Bug
>            Reporter: Jolly Chen
>            Assignee: Sean Mackrory
>         Attachments: 0001-BIGTOP-1011.-bigtop-detect-javahome-has-a-quirky-sea.patch, 0001-BIGTOP-1011.-bigtop-detect-javahome-has-a-quirky-sea.patch
>
>
> If JAVA_HOME is not set, bigtop-detect-javahome has a very quirky search order that can have surprising behavior.
> Some problems:
>   - because the "defaults" (like /usr/java/default, /usr/lib/jvm/default-java, /Library/Java/Home) are in the middle of the search list, bigtop will pick up other random JDKs instead of the 'default' the user already has set up on the system.
>   - due to use of wildcards, earlier minor versions can be preferred over later minor versions, e.g. /usr/java/jdk1.6* will find 1.6.0_31 before 1.6.0_43, which is probably not what the user wants.
>   - 1.6 and 1.7 preference order is not consistent (e.g. generally 1.6 is preferred over 1.7 but not for openJDK)
> This is related to previous issue: https://issues.apache.org/jira/browse/BIGTOP-843
> # attempt to find java
> if [ -z "$JAVA_HOME" ]; then
>   for candidate in \
>     /usr/lib/j2sdk1.6-sun \
>     /usr/lib/jvm/java-6-sun \
>     /usr/lib/jvm/java-1.6.0-sun-1.6.0.* \
>     /usr/lib/jvm/java-1.6.0-sun-1.6.0.*/jre/ \
>     /usr/lib/jvm/j2sdk1.6-oracle \
>     /usr/lib/jvm/j2sdk1.6-oracle/jre \
>     /usr/java/jdk1.6* \
>     /usr/java/jre1.6* \
>     /usr/java/jdk1.7* \
>     /usr/java/jre1.7* \
>     /usr/lib/jvm/j2sdk1.7-oracle \
>     /usr/lib/jvm/j2sdk1.7-oracle/jre \
>     /Library/Java/Home \
>     /usr/java/default \
>     /usr/lib/jvm/default-java \
>     /usr/lib/jvm/java-openjdk \
>     /usr/lib/jvm/jre-openjdk \
>     /usr/lib/jvm/java-1.7.0-openjdk* \
>     /usr/lib/jvm/java-7-openjdk* \
>     /usr/lib/jvm/java-7-oracle* \
>     /usr/lib/jvm/java-1.6.0-openjdk \
>     /usr/lib/jvm/java-1.6.0-openjdk-* \
>     /usr/lib/jvm/jre-1.6.0-openjdk* ; do

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira