Bug 1145683 - rhqctl install on Solaris 10 displays - ./cassandra: test: unknown operator >
Summary: rhqctl install on Solaris 10 displays - ./cassandra: test: unknown operator >
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Installer
Version: JON 3.3.0
Hardware: x86_64
OS: Solaris
unspecified
urgent
Target Milestone: ER05
: JON 3.3.0
Assignee: RHQ Project Maintainer
QA Contact: Sunil Kondkar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-23 13:48 UTC by Sunil Kondkar
Modified: 2014-12-11 14:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-11 14:03:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Sunil Kondkar 2014-09-23 13:48:17 UTC
Description of problem:

Tried ./rhqctl install using Bourne Shell on Solaris 10:

the console displays a message "./cassandra: test: unknown operator >" and it does not proceed after installing the storage node:

--------
15:06:28,920 INFO  [org.rhq.server.control.command.Install] The storage node installer has finished with an exit value of 0
./cassandra: test: unknown operator >
15:06:28,937 INFO  [org.rhq.server.control.command.Install] Pausing to ensure RHQ Storage is initialized prior to RHQ Server installation.
#
-----------

Trying to install rhq server which results into the same message:

# ./rhqctl install --server

-------------------
WARNING: The readlink command is not available on this platform.
         If this script was launched from a symbolic link, errors may occur.
         Consider installing readlink on this platform.
16:50:28,104 INFO  [org.jboss.modules] JBoss Modules version 1.3.3.Final-redhat-1
./cassandra: test: unknown operator >
16:50:28,798 INFO  [org.rhq.server.control.command.Install] Pausing to ensure RHQ Storage is initialized prior to RHQ Server installation.
#

------------

Environment details:

# uname -sr
SunOS 5.10
# echo $SHELL
/sbin/sh

Version-Release number of selected component (if applicable):

JON 3.3 ER03

How reproducible:

Always

Steps to Reproduce:
1. On Solaris 10, try ./rhqctl install
2. Console display a message ./cassandra: test: unknown operator > and installation does not proceed.


Actual results:

Installation does not work on solaris 10 displaying ./cassandra: test: unknown operator >

Expected results:

Installation succeeds.

Additional info:

Comment 1 John Sanda 2014-09-23 13:55:19 UTC
Setting this to ER05 for now as I doubt anyone will get to it before the ER04 code freeze.

Comment 3 John Mazzitelli 2014-09-23 19:13:55 UTC
I know what the problem is, just need to figure out how Solaris 10 wants the syntax to look.

The problem is in "rhq-storage/bin/cassandra.in.sh", specifically in this if-statement:

   # set JVM javaagent opts to avoid warnings/errors
   if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
         || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]

That "\>" comparator isn't supported on Solaris 10. That is what is causing the error.

Comment 4 John Mazzitelli 2014-09-30 17:36:08 UTC
It looks like on Fedora (and presumably everyone else BUT solaris), this statement is valid and does what it looks like it does:

if [ "$JVM_VERSION" \> "1.6.0"]
then
   echo JVM_VERSION is greater than 1.6.0
fi

On my tests on Fedora, changing that env var to 1.5.9 results in false, whereas 1.7.0 results in true as expected.

But on Solaris 10, that > operator doesn't work like that (note, if I take out the backslash, I don't get that error message on Solaris, but it doesn't work as expected either).

Comment 5 John Mazzitelli 2014-09-30 21:19:06 UTC
The if-stmt in question is this:

# set JVM javaagent opts to avoid warnings/errors
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
      || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
then
    JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar"
fi

What this is saying is:

IF JVM is NOT OpenJDK OR JVM version is higher than 1.6.0, then set -javaagent
IF JVM version is exactly 1.6.0 but patch version is greater than 23 then set -javagent

Essentially, what this basically means is "if java version is less than 1.6.0, don't set -javaagent" (ignore the OpenJDK thing for now).

But because JON doesn't support JRE 1.5 or less, we don't have to worry about that.

So I think this means we can take out that use of the > operator (which is what Solaris is barfing on). We can just say in that left side of the || operator:

IF jvm vendor is NOT OpenJDK OR JVM version is NOT 1.6.0. Yes, this is true for 1.5.0 just as well as it is for 1.7.0, but we don't support 1.5.0 anyway - users won't be starting the storage nodes using that JRE 1.5.0 (or less).

The actual script code could be, thus:

# set JVM javaagent opts to avoid warnings/errors
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" != "1.6.0" ] \
      || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
then
    JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar"
fi

That removes the invalid > operator but retains the semantics we really need in reality. Again, this will allow for the then-clause to run if JRE is 1.5 or less, but that's moot because we just won't be running with that version anyway (other massive failures elsewhere will occur if users do that).

Comment 6 John Mazzitelli 2014-10-01 14:43:29 UTC
to master:

commit 096e1049c5f8b92322339e2de7a73bb750793af7
Author: John Mazzitelli <mazz>
Date:   Wed Oct 1 10:42:05 2014 -0400

    BZ 1145683 - change if-stmt so it can work on solaris 10

Comment 7 John Mazzitelli 2014-10-01 16:37:42 UTC
cherry picked to release 3.3 branch:

commit e29037cfe657f63c679a290409fa75b80eeeabcd
Author: John Mazzitelli <mazz>
Date:   Wed Oct 1 10:42:05 2014 -0400

Comment 8 Simeon Pinder 2014-10-21 20:24:21 UTC
Moving to ON_QA as available to test with the latest brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=394734

Comment 9 Sunil Kondkar 2014-10-30 14:07:23 UTC
Verified on JON3.3 ER05. rhqctl install on Solaris 10 proceeds successfully.


Note You need to log in before you can comment on or make changes to this bug.