Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1244351 - RFC: Rebase rhino in RHEL-6 to provide JSON support via OpenJDK
RFC: Rebase rhino in RHEL-6 to provide JSON support via OpenJDK
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rhino (Show other bugs)
6.6
All All
low Severity low
: rc
: ---
Assigned To: Severin Gehwolf
Lukas Zachar
Lenka Špačková
: Rebase
: 911278 (view as bug list)
Depends On:
Blocks: 1172231 1271375
  Show dependency treegraph
 
Reported: 2015-07-17 17:38 EDT by Paulo Andrade
Modified: 2016-05-10 15:37 EDT (History)
7 users (show)

See Also:
Fixed In Version: rhino-1.7R4-1.el6, java-1.7.0-openjdk-1.7.0.91-2.6.2.4.el6
Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
_rhino_ rebased to version 1.7R4 *Rhino*, an open-source implementation of JavaScript written in Java, has been rebased to version 1.7R4. This update fixes a JSON-related bug in the _java-1.7.0-openjdk_ package, which uses _rhino_ as a build dependency. Additionally, the previously missing manual page, README and LICENSE files have been added.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-10 15:37:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
js.jar (1010 bytes, application/zip)
2015-07-17 17:38 EDT, Paulo Andrade
no flags Details
JSMain2.java (563 bytes, text/plain)
2015-07-17 17:40 EDT, Paulo Andrade
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2016:0746 normal SHIPPED_LIVE rhino bug fix update 2016-05-10 18:31:22 EDT

  None (edit)
Description Paulo Andrade 2015-07-17 17:38:17 EDT
Created attachment 1053234 [details]
js.jar

The expected output is:

$ java -jar js.jar
"a":"b"
b

what works on rhel7 and fedora 18, but on
rhel6 it outputs:

Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:224)
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:240)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at js.JSMain2.main(JSMain2.java:11)
Caused by: sun.org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not defined. (<Unknown source>#1)
...

From my understanding, it would be fixed with these steps:
1. rhel6 updates to rhino-1.7R4 so that it would have a
   real /usr/share/java/js.jar, that is, js.jar would not
   be a symlink to rhino.jar
2. After the above, java-1.7.0-openjdk would need to be
   rebuilt with the newer rhino, so that on rhel6
   $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep -i json
   would show something.

As an example, on rhel7 I see:
$ jar tvf /usr/lib/jvm/java-1.7.0-openjdk/jre/lib/rhino.jar |grep -i json
     0 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/
  7273 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/JsonParser.class
   748 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/JsonParser$ParseException.class
 14224 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/NativeJSON.class
  1603 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/NativeJSON$StringifyState.class
Comment 1 Paulo Andrade 2015-07-17 17:40:23 EDT
Created attachment 1053235 [details]
JSMain2.java

Source for the js.jar. It may be useful for extra
testing, as with java-1.8.0-openjdk, the sample
test fail as:

$ java -jar js.jar
Exception in thread "main" javax.script.ScriptException: ReferenceError: "println" is not defined in <eval> at line number 1
	at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:455)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:439)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:401)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:397)
	at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:152)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at js.JSMain2.main(JSMain2.java:11)
Caused by: <eval>:1 ReferenceError: "println" is not defined
...
Comment 2 Deepak Bhole 2015-07-17 17:49:22 EDT
Hi Paulo, as you noted, fixing this will require an update to rhino itself, which may have consequences for other packages.

Since this is a rebase request then, I am updating the summary a bit and changing the component.
Comment 3 Deepak Bhole 2015-07-17 17:50:35 EDT
Re-assigning to Severin for update (after acks are granted) and to investigate the OpenJDK8 error in comment #1.
Comment 5 Andrew John Hughes 2015-07-19 18:07:09 EDT
The OpenJDK 8 issue should probably be a separate bug; 8 doesn't use Rhino, but its own Javascript implementation called Nashorn.
Comment 8 Severin Gehwolf 2015-07-20 13:21:44 EDT
(In reply to Deepak Bhole from comment #2)
> Since this is a rebase request then, I am updating the summary a bit and
> changing the component.

Just to clarify: The fix requires rebasing rhino *and* a rebuild of java-1.7.0-openjdk (with the rebased rhino).
Comment 9 Severin Gehwolf 2015-07-20 13:27:57 EDT
(In reply to Paulo Andrade from comment #0)
> From my understanding, it would be fixed with these steps:
> 1. rhel6 updates to rhino-1.7R4 so that it would have a
>    real /usr/share/java/js.jar, that is, js.jar would not
>    be a symlink to rhino.jar
> 2. After the above, java-1.7.0-openjdk would need to be
>    rebuilt with the newer rhino, so that on rhel6
>    $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep
> -i json
>    would show something.

That's right. On my local RHEL-6 system:

$ rpm -q rhino
rhino-1.7R4-5.el6.noarch
$ rpm -qf /usr/share/java/js.jar
rhino-1.7R4-5.el6.noarch
$ jar tvf /usr/share/java/js.jar | grep -i json
  1551 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/NativeJSON$StringifyState.class
 14004 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/NativeJSON.class
     0 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/
   736 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/JsonParser$ParseException.class
  7209 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/JsonParser.class

Then after a java-1.7.0-openjdk rebuild with this:

$ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep -i json
     0 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/
   748 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/JsonParser$ParseException.class
  7273 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/JsonParser.class
 14284 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/NativeJSON.class
  1603 Mon Jul 20 18:35:32 CEST 2015 sun/org/mozilla/javascript/NativeJSON$StringifyState.class
$ /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java JSMain2
"a":"b"
b
Comment 16 Deepak Bhole 2015-10-21 10:19:39 EDT
*** Bug 911278 has been marked as a duplicate of this bug. ***
Comment 26 Andrew John Hughes 2016-03-28 22:08:49 EDT
I'd make one tiny adjustment to the docs:

"previously missing manual page and README and LICENSE files have been added"

to

"the previously missing manual page, README and LICENSE files have been added"
Comment 29 errata-xmlrpc 2016-05-10 15:37:42 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-0746.html

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