Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7460

bin/solr start command shows an error when used with Java 1.7.0 - bin/solr: line 1290: [[: .0: syntax error: operand expected (error token is ".0")

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 5.1
    • Fix Version/s: None
    • Component/s: scripts and tools
    • Labels:

      Description

      I am trying to start Solr 5.1.0 using Java 1.7.0, Solr does start but I see this error:

      $ bin/solr start
      bin/solr: line 1290: [[: .0: syntax error: operand expected (error token is ".0")
      Waiting to see Solr listening on port 8983 [/]
      Started Solr server on port 8983 (pid=13627). Happy searching!

      Digging further, I saw in solr script:

      1285 JAVA_VERSION=`echo "$("$JAVA" -version 2>&1)" | grep "java version" | awk '

      { print substr($3, 2, length($3)-2); }

      '`
      1286 if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
      1287 # Specific Java version hacking
      1288 #GC_TUNE+=('-XX:CMSFullGCsBeforeCompaction=1' '-XX:CMSTriggerPermRatio=80')
      1289 JAVA_MINOR_VERSION=${JAVA_VERSION-2)}
      1290 if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
      1291 GC_TUNE+=('-XX:-UseSuperWord')
      1292 echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"

      When JAVA_VERSION is 1.7.0 to 1.7.9 the line (#1289):

      JAVA_MINOR_VERSION=${JAVA_VERSION-2)}

      will evaluate JAVA_MINOR_VERSION as .0 hence the if check that follows fails.

      The above code would work fine for Java versions 1.7.10 and above

      This line should be changed to (chop the string 4 positions from start to get the minor version, instead of chopping 2 positions from the end)

      JAVA_MINOR_VERSION=${JAVA_VERSION:(4)}

        Attachments

        1. screenshot-1.png
          99 kB
          Prasanta Behera
        2. screenshot.png
          36 kB
          Prasanta Behera

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pkbehera Prasanta Behera
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: