Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1244351

Summary: RFC: Rebase rhino in RHEL-6 to provide JSON support via OpenJDK
Product: Red Hat Enterprise Linux 6 Reporter: Paulo Andrade <pandrade>
Component: rhinoAssignee: Severin Gehwolf <sgehwolf>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: low Docs Contact: Lenka Špačková <lkuprova>
Priority: low    
Version: 6.6CC: ahughes, bgollahe, bkearney, cww, dbhole, dkutalek, jvanek
Target Milestone: rcKeywords: Rebase
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
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 19:37:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1172231, 1271375    
Attachments:
Description Flags
js.jar
none
JSMain2.java none

Description Paulo Andrade 2015-07-17 21:38:17 UTC
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 21:40:23 UTC
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 21:49:22 UTC
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 21:50:35 UTC
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 22:07:09 UTC
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 17:21:44 UTC
(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 17:27:57 UTC
(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 14:19:39 UTC
*** Bug 911278 has been marked as a duplicate of this bug. ***

Comment 26 Andrew John Hughes 2016-03-29 02:08:49 UTC
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 19:37:42 UTC
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