Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1166474 - rubygem-execjs does not pull in a JavaScript engine
Summary: rubygem-execjs does not pull in a JavaScript engine
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rubygem-execjs
Version: rawhide
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Vít Ondruch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1176677
Blocks: ARMTracker DuplicSysLibsTracker PPCTracker ARM64, F-ExcludeArch-aarch64 F-ExcludeArch-ppc64le, PPC64LETracker
TreeView+ depends on / blocked
 
Reported: 2014-11-21 04:23 UTC by Yaakov Selkowitz
Modified: 2017-05-11 08:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-11 08:45:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch for f21/f22 (2.79 KB, patch)
2014-11-21 04:28 UTC, Yaakov Selkowitz
no flags Details | Diff
Patch for f20 (2.98 KB, patch)
2014-11-21 04:49 UTC, Yaakov Selkowitz
no flags Details | Diff

Description Yaakov Selkowitz 2014-11-21 04:23:40 UTC
On a clean system, F20 or F21, regardless of arch:

$ sudo yum install rubygem-execjs
[snip]
$ irb
irb(main):001:0> require "execjs"
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
        from /usr/share/gems/gems/execjs-2.2.0/lib/execjs/runtimes.rb:51:in `autodetect'
        from /usr/share/gems/gems/execjs-2.2.0/lib/execjs.rb:5:in `<module:ExecJS>'
        from /usr/share/gems/gems/execjs-2.2.0/lib/execjs.rb:4:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:135:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:144:in `require'
        from (irb):1
        from /usr/bin/irb:11:in `<main>'

Where the expected result would be:

$ irb
irb(main):001:0> require 'execjs'
=> true
irb(main):002:0> ExecJS.eval "'red yellow blue'.split(' ')"
=> ["red", "yellow", "blue"]

In order to be usable OOTB, rubygem-execjs should Requires: an appropriate JavaScript engine.  On x86 and armv7, the default should clearly be rubygem-therubyracer.  However, that requires v8, which is not yet ready on the current secondary arches (aarch64, ppc64, ppc64le).  For those, AFAICS the best alternative is JavaScriptCore; the only caveat is that /usr/bin/jsc is currently packaged with webkitgtk4-devel, which pulls in a TON of extra unneeded dependencies.  (JSC itself only requires glib2 and libicu.)

Comment 2 Yaakov Selkowitz 2014-11-21 04:36:34 UTC
(In reply to Yaakov Selkowitz from comment #1)
> http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=2192169 (ppc64/le)

Correction: http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=2192168

Comment 3 Yaakov Selkowitz 2014-11-21 04:49:46 UTC
Created attachment 959537 [details]
Patch for f20

Scratch builds:

http://koji.fedoraproject.org/koji/taskinfo?taskID=8198666 (x86/armv7)
http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=2192303 (ppc/ppc64)

Comment 4 Vít Ondruch 2014-11-21 08:25:08 UTC
I understand your concern and intention. Nevertheless, I cannot accept the patch, since:

1) Neither upstream execjs pulls in any JS framework and the choice is up to user.
2) I don't want to force any non-required dependencies. E.g. if we go with therubyracer, but somebody wants to use NodeJS instead, there would be no way how to get rid of therubyracer package from the system. This is unacceptable (especially considering how much dependencies might be pulled in due to this).

The solution for F21 and older is to use comps and I believe that therubyracer is included in rubyonrails group.

For F22, I would consider Recommends dependencies instead of Requires.

Comment 5 Yaakov Selkowitz 2014-11-21 15:29:22 UTC
(In reply to Vít Ondruch from comment #4)
> I understand your concern and intention. Nevertheless, I cannot accept the
> patch, since:
> 
> 1) Neither upstream execjs pulls in any JS framework and the choice is up to
> user.

On secondary arches, there currently is NO choice, the only upstream-supported JS engine available is JSC.

> 2) I don't want to force any non-required dependencies. E.g. if we go with
> therubyracer, but somebody wants to use NodeJS instead, there would be no
> way how to get rid of therubyracer package from the system. This is
> unacceptable (especially considering how much dependencies might be pulled
> in due to this).

Both therubyracer and nodejs require v8, so the only "extra" dependency in such a scenario would be rubygem-ref:

http://koji.fedoraproject.org/koji/rpminfo?rpmID=5484240
http://koji.fedoraproject.org/koji/rpminfo?rpmID=5768388

> The solution for F21 and older is to use comps and I believe that
> therubyracer is included in rubyonrails group.

That neither helps nor works for secondary arches.

Keep in mind that, due to the runtime tests in %check, that execjs currently cannot even be rebuilt on a secondary arch, e.g.:

http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2796540

At the minimum, everything but the added Requires: is necessary to make this package both build and run (after installing jsc) on secondary arches.

Comment 6 Vít Ondruch 2014-12-22 15:43:52 UTC
(In reply to Yaakov Selkowitz from comment #5)
> (In reply to Vít Ondruch from comment #4)
> > I understand your concern and intention. Nevertheless, I cannot accept the
> > patch, since:
> > 
> > 1) Neither upstream execjs pulls in any JS framework and the choice is up to
> > user.
> 
> On secondary arches, there currently is NO choice, the only
> upstream-supported JS engine available is JSC.

If JSC works, it makes sense to enable it by applying your patch. It also makes sense to ask upstream to support JSC not only on Macs, since it seems to be issue for other platforms as well [1].

> Keep in mind that, due to the runtime tests in %check, that execjs currently
> cannot even be rebuilt on a secondary arch, e.g.:
> 
> http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2796540

We should make it build, definitely.

Unfortunately, trying JSC on x86_64, it just segfaults. Moreover, since the jsc executable is available just in -devel subpackage, I am not sure how well it is supported.

Would you mind to pursue webkitgtk4 maintainer to split the JSC into more reasonable subpackage and make it work actually?


[1] https://github.com/sstephenson/execjs/issues/154#issuecomment-67840655

Comment 7 Yaakov Selkowitz 2014-12-22 19:30:36 UTC
(In reply to Vít Ondruch from comment #6)
> If JSC works, it makes sense to enable it by applying your patch. It also
> makes sense to ask upstream to support JSC not only on Macs, since it seems
> to be issue for other platforms as well [1].

The patch would need a bit of work to upstream, but it would be easier if we could rely on just "jsc" from webkitgtk4 and not jsc-{1,3} from the now-deprecated webkitgtk{,3}.

> Unfortunately, trying JSC on x86_64, it just segfaults.

The examples shown at https://github.com/sstephenson/execjs WFM on both x86_64 and aarch64 (after patching runtimes.rb).  What exactly did you do?  

> Moreover, since the jsc executable is available just in -devel subpackage, I 
> am not sure how well it is supported.

I imagine that was due to lack of consumers.

> Would you mind to pursue webkitgtk4 maintainer to split the JSC into more
> reasonable subpackage and make it work actually?

Filed bug 1176677.

Comment 8 Vít Ondruch 2014-12-23 09:15:12 UTC
(In reply to Yaakov Selkowitz from comment #7)
> (In reply to Vít Ondruch from comment #6)
> > If JSC works, it makes sense to enable it by applying your patch. It also
> > makes sense to ask upstream to support JSC not only on Macs, since it seems
> > to be issue for other platforms as well [1].
> 
> The patch would need a bit of work to upstream, but it would be easier if we
> could rely on just "jsc" from webkitgtk4 and not jsc-{1,3} from the
> now-deprecated webkitgtk{,3}.

Yes, sure. I'm interested what upstream thinks about this, since there are more directions in which the patch could be modified.

> > Unfortunately, trying JSC on x86_64, it just segfaults.
> 
> The examples shown at https://github.com/sstephenson/execjs WFM on both
> x86_64 and aarch64 (after patching runtimes.rb).  What exactly did you do? 

This is my SRPM: 

https://vondruch.fedorapeople.org/rubygem-execjs-2.2.2-1.fc22.src.rpm

And the testsuite fails entirely. In a background, the test suite creates file with content such as:

$ cat /tmp/execjs20141222-11666-14a8cabjs
          (function(program, execJS) { execJS(program) })(function() {
  return eval("(function(){ \n1 })()");
}, function(program) {
  var output;
  try {
    result = program();
    if (typeof result == 'undefined' && result !== null) {
      print('["ok"]');
    } else {
      try {
        print(JSON.stringify(['ok', result]));
      } catch (err) {
        print('["err"]');
      }
    }
  } catch (err) {
    print(JSON.stringify(['err', '' + err]));
  }
});



and runs:

$ jsc /tmp/execjs20141222-11666-14a8cabjs
Segmentation fault (core dumped)


> > Would you mind to pursue webkitgtk4 maintainer to split the JSC into more
> > reasonable subpackage and make it work actually?
> 
> Filed bug 1176677.

Thx!

Comment 9 Yaakov Selkowitz 2014-12-26 05:41:03 UTC
(In reply to Vít Ondruch from comment #8)
> (In reply to Yaakov Selkowitz from comment #7)
> > (In reply to Vít Ondruch from comment #6)
> > > Unfortunately, trying JSC on x86_64, it just segfaults.
> > 
> > The examples shown at https://github.com/sstephenson/execjs WFM on both
> > x86_64 and aarch64 (after patching runtimes.rb).  What exactly did you do? 
> 
> This is my SRPM: 
> 
> https://vondruch.fedorapeople.org/rubygem-execjs-2.2.2-1.fc22.src.rpm
> 
> And the testsuite fails entirely.

Only on rawhide.  On F21 -- which is what I was testing in the first place -- it passes if you uncomment the LANG=en_US.utf8 line.

Comment 10 Yaakov Selkowitz 2015-04-20 13:23:13 UTC
Since upstream 2.5.0 (released earlier this month), ExecJS now supports Duktape as a backend.  F21+ are all at 2.2.0, so I haven't tested ExecJS with it, but Duktape itself does seem to work properly on AArch64.  Therefore, the combination of a rubygem-execjs version bump and the addition of rubygem-duktape (which will require figuring out how to handle the bundled duktape.c) would provide a lightweight and portable alternative for all arches.

Comment 11 Fedora End Of Life 2015-11-04 12:36:06 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Jan Kurik 2016-02-24 13:17:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 13 Vít Ondruch 2016-08-31 12:12:55 UTC
Does the switch from therubyracer to node for the test suite [1] changes the situation? Is NodeJS supported on all architectures now?


[1] http://pkgs.fedoraproject.org/cgit/rpms/rubygem-execjs.git/commit/?id=3c0f1ff0c98c30d501659beea540aa206f2c3d66

Comment 14 Yaakov Selkowitz 2016-08-31 15:43:17 UTC
nodejs since 4.x (F24) is supported on both aarch64 and ppc64{,le}.

Comment 15 Vít Ondruch 2017-05-11 08:45:29 UTC
I don't think there is any action needed at this point. NodeJs is used to execute the test suite and it is available on all supported platforms.


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