Bug 57608 - Java version check in bin/jmeter script in 2.12 fails on Solaris 10
Summary: Java version check in bin/jmeter script in 2.12 fails on Solaris 10
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.12
Hardware: Sun Solaris
: P5 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-19 23:16 UTC by Michael Strasser
Modified: 2015-02-20 05:17 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Strasser 2015-02-19 23:16:11 UTC
The Java version check code in bin/jmeter script in 2.12 fails when run on Solaris 10.

Example failure output:

-bash-3.2$ /opt/apache-jmeter-2.12/bin/jmeter
/opt/apache-jmeter-2.12/bin/jmeter: syntax error at line 32: `CURRENT_VERSION=$' unexpected

Line 32 contains:

CURRENT_VERSION=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')

This syntax is not accepted by the standard shell /bin/sh.

More about the system:

-bash-3.2$ uname -a
SunOS ssessdevbuild 5.10 Generic_147147-26 sun4v sparc sun4v

JMeter 2.11 does not have the Java version check and works on Solaris 10.
Comment 1 Rainer Jung 2015-02-20 03:15:32 UTC
Could you please check, whether

CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}'`

works for you? It should be compatible with any shel.

Any other problems with the script?

Thanks,

Rainer
Comment 2 Michael Strasser 2015-02-20 04:30:33 UTC
Hi Rainer, thanks for your quick response.

Replacing $( ... ) with ` ... ` works in this Solaris shell.

There was also a problem with the awk command in the same line. The version of awk on Solaris 10 cannot have a space between the -F option and the field separator (gawk allows one).

Here is a diff between the original and the version that works on Solaris:

-bash-3.2$ diff jmeter.orig jmeter
32,34c32,34
< CURRENT_VERSION=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
< minimal_version=$(echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }')
< current_version=$(echo $CURRENT_VERSION | awk -F'.' '{ print $2 }')
---
> CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'`
> minimal_version=`echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }'`
> current_version=`echo $CURRENT_VERSION | awk -F'.' '{ print $2 }'`
46c46
< case $(uname) in
---
> case `uname` in
Comment 3 Rainer Jung 2015-02-20 05:17:28 UTC
I also fixed the $(uname) and applied the change to both, bin/jmeter.sh and bin/jmeter which in trunk both had the problematic lines. No other JMeter shell scripts seem to use the sub shell notation $(...).
Comment 4 Rainer Jung 2015-02-20 05:17:53 UTC
Date: Fri Feb 20 05:15:13 2015
New Revision: 1661060

URL: http://svn.apache.org/r1661060
Log:
Bug 57608 - Java version check in bin/jmeter script
in 2.12 fails on Solaris 10

Bugzilla Id: 57608

Modified:
    jmeter/trunk/bin/jmeter
    jmeter/trunk/bin/jmeter.sh
    jmeter/trunk/xdocs/changes.xml