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 2007791 - Review Request: rhino - JavaScript for Java
Summary: Review Request: rhino - JavaScript for Java
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mikolaj Izdebski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2007626
TreeView+ depends on / blocked
 
Reported: 2021-09-24 21:41 UTC by Didik Supriadi
Modified: 2021-10-13 09:09 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-10-13 09:09:49 UTC
Type: ---
Embargoed:
mizdebsk: fedora-review+


Attachments (Terms of Use)

Description Didik Supriadi 2021-09-24 21:41:02 UTC
Spec URL: https://didiksupriadi41.fedorapeople.org/rhino.spec
SRPM URL: https://didiksupriadi41.fedorapeople.org/rhino-1.7.13-1.fc34.src.rpm

Description:
Rhino is an open-source implementation of JavaScript written entirely
in Java. It is typically embedded into Java applications to provide
scripting to end users.

Fedora Account System Username: didiksupriadi41

Comment 1 Didik Supriadi 2021-09-24 21:41:05 UTC
This package built on koji:  https://koji.fedoraproject.org/koji/taskinfo?taskID=76242288

Comment 2 Raphael Groner 2021-09-25 11:03:42 UTC
Thanks for interest in rhino. But why a new review? This package is still in repo but orphaned. Please try to claim ownership instead before it gets fully retired.

Comment 3 Raphael Groner 2021-10-04 19:22:32 UTC
Try to run provided test suite for ECMAScript in %check.

https://github.com/tc39/test262/tree/f94fc660cc3c59b1f2f9f122fc4d44b4434b935c

In %files can you be more specific instead of just wildcards similiar as done for %doc with .md?

> %{_bindir}/*
> %{_mandir}/man1/*

Why not use gradle as upstream recommends, instead of maven with downstream patch?

Comment 4 Raphael Groner 2021-10-04 19:25:51 UTC
I'd also suggest to ship examples/ in %doc .

For %check, execution of tests is explained: https://github.com/mozilla/rhino/blob/master/testsrc/README.md

Comment 5 Didik Supriadi 2021-10-04 23:54:09 UTC
(In reply to Raphael Groner from comment #3)
> Try to run provided test suite for ECMAScript in %check.
> 
> https://github.com/tc39/test262/tree/f94fc660cc3c59b1f2f9f122fc4d44b4434b935c

I'd see if I could manage to run this test because I had to convert things to maven.

> In %files can you be more specific instead of just wildcards similiar as
> done for %doc with .md?
> 
> > %{_bindir}/*
> > %{_mandir}/man1/*

Yes, I could do that instead.

> Why not use gradle as upstream recommends, instead of maven with downstream
> patch?

gradle has been long dead [1] and it's not possible to package.
I had to convert rhino to maven somehow.

(In reply to Raphael Groner from comment #4)
> I'd also suggest to ship examples/ in %doc .
> 
> For %check, execution of tests is explained:
> https://github.com/mozilla/rhino/blob/master/testsrc/README.md

rhino only includes rhino-engine and rhino-runtime in maven central.
I'm afraid I could not do that.

Usually, I have to check jars that I produce is compatible with jars in maven central.

[1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/BMJXGWKXXFOOBQON3XFYPFBOWEZMAKKU/
[2] https://repo1.maven.org/maven2/org/mozilla/

Comment 6 Didik Supriadi 2021-10-05 15:46:28 UTC
I've integrate some of rhino tests but it's the best I could do for now.

There are failures because I don't know how gradle run this tests 3 times, because maven can only do it 1 times. [1]
For examples, if I ran individual tests: 
`java -cp (test-class):(class):(junit):(hamcrest) org.junit.runner.JUnitCore org.mozilla.javascript.tests.Bug708801Test`, it succeed.
But my conversion to maven seems failed.

If I add more tests from test262, I'm afraid it just brings more failures. [2]

[1] https://github.com/mozilla/rhino/blob/263655bae3dc1089bd67b158db3e0a191c94c589/testsrc/README.md#running-tests
[2] https://fedoraproject.org/wiki/Java_packaging_common_problems#Ignoring_failures

Comment 7 Didik Supriadi 2021-10-05 15:53:21 UTC
* I forgot to mention that class org.junit.runner.JUnitCore org.mozilla.javascript.tests.Bug708801Test was in the failures list.

Comment 8 Raphael Groner 2021-10-05 18:19:52 UTC
Thanks. Successful execution of some tests gives trust in available functionality and package usefulness. B0rken tests should get disabled and commented with reason and maybe reported to upstream, but from my experience sometimes downstream environment causes random failure.

Comment 9 Mikolaj Izdebski 2021-10-05 18:42:03 UTC
There is a mismatch between SRPM and the spec file. The SRPM corresponds to version 1.7.13 release 1, but spec file is at release 2. Please provide up-to-date URLs to SRPM and spec file.

The spec file (for release 2) looks good, it uses current packaging techniques.
Building with Maven is a good approach as Gradle is not available any longer.
I agree that it's better to disable particular tests that are known to fail rather than ignore test failures.

Comment 10 Didik Supriadi 2021-10-05 18:46:41 UTC
Ah, I forgot to upload it here since it has different name in the URL.

SRPM URL: https://didiksupriadi41.fedorapeople.org/rhino-1.7.13-2.fc34.src.rpm

Comment 11 Didik Supriadi 2021-10-06 10:35:41 UTC
(In reply to Mikolaj Izdebski from comment #9)
> ...
> I agree that it's better to disable particular tests that are known to fail
> rather than ignore test failures.

Spec URL: https://didiksupriadi41.fedorapeople.org/rhino.spec
SRPM URL: https://didiksupriadi41.fedorapeople.org/rhino-1.7.13-3.fc34.src.rpm

I've tried to disable it with @Ignore but it didn't work.
it keeps outputting: 
- org.mozilla.javascript.tests.(ClassName).org.mozilla.javascript.tests.(ClassName).(testName)
  I don't know why but the name of the class is doubled here. Suggestions are welcome.

last resort, I've disabled the tests by removing the tests method.

Comment 12 Mikolaj Izdebski 2021-10-06 12:12:13 UTC
Some initial findings:
- URL in the spec file is broken, it points to "Page not found"
- license should include BSD, as some of the source files are under BSD (v8dtoa and treetable); licensing breakdown should be added as a comment
- missing Requires on javapackages-tools in rhino-engine package break the launcher script
- test failures are worrying and should be fixed (this is highly recommended, but not mandatory; failing tests are not review blockers; I can still approve the package even if you insist on ignoring test failures)

Regarding test failures, I've attempted to fix them. Different test failures and errors can be fixed by:
- changing working directory where tests are ran (workingDirectory setting of maven-surefire-plugin); tests expect resources in certain locations relative to CWD
- running each test in a separate fork (forkCount=1, reuseForks=false settings of surefire); many tests do not clean up contexts properly, this makes the tests much more resilient at the expense of performance. See comment in build.gradle line 84
- changing version of junit test dependency from SYSTEM to 4.13; surefire needs this to detect junit version in use; if you set version to SYSTEM surefire assumes junit 3
- setting various system properties (see lines 75-81 of build.gradle)

Benchmark tests will probably need to be disabled, or their expected times adjusted, otherwise they will fail in Koji on ARM.

Can you fix the above issues and failing tests?

Comment 13 Mikolaj Izdebski 2021-10-06 12:14:27 UTC
(In reply to Didik Supriadi from comment #11)
> I've tried to disable it with @Ignore but it didn't work.

@Ignore is JUnit 4 annotation, but you run tests with JUnit 3. Changing dependency version from SYSTEM to 4.13 should fix this.

Comment 14 Didik Supriadi 2021-10-07 04:45:39 UTC
Spec URL: https://didiksupriadi41.fedorapeople.org/rhino.spec
SRPM URL: https://didiksupriadi41.fedorapeople.org/rhino-1.7.13-4.fc34.src.rpm

(In reply to Mikolaj Izdebski from comment #12)
> Some initial findings:
> - URL in the spec file is broken, it points to "Page not found"
OK
> - license should include BSD, as some of the source files are under BSD
> (v8dtoa and treetable); licensing breakdown should be added as a comment
OK
> - missing Requires on javapackages-tools in rhino-engine package break the
> launcher script
OK
> - test failures are worrying and should be fixed (this is highly
> recommended, but not mandatory; failing tests are not review blockers; I can
> still approve the package even if you insist on ignoring test failures)
> 
> Regarding test failures, I've attempted to fix them. Different test failures
> and errors can be fixed by:
> - changing working directory where tests are ran (workingDirectory setting
> of maven-surefire-plugin); tests expect resources in certain locations
> relative to CWD
OK
> - running each test in a separate fork (forkCount=1, reuseForks=false
> settings of surefire); many tests do not clean up contexts properly, this
> makes the tests much more resilient at the expense of performance. See
> comment in build.gradle line 84
Hmm, I need your help. Failed to set reuseForks to false, here's the error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project rhino: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed: java.lang.reflect.InvocationTargetException: org/apache/commons/lang3/StringUtils: org.apache.commons.lang3.StringUtils -> [Help 1]

> - changing version of junit test dependency from SYSTEM to 4.13; surefire
> needs this to detect junit version in use; if you set version to SYSTEM
> surefire assumes junit 3
OK
> - setting various system properties (see lines 75-81 of build.gradle)
OK
> 
> Benchmark tests will probably need to be disabled, or their expected times
> adjusted, otherwise they will fail in Koji on ARM.
OK

With all that except reuseForks, I got: 
- [ERROR] Tests run: 95316, Failures: 9969, Errors: 22, Skipped: 2 (with test262 included)
- [ERROR] Tests run: 10192, Failures: 109, Errors: 23, Skipped: 2 (without test262)

Also when I run test262 (org.mozilla.javascript.tests.Test262SuiteTest) individually, it succeed.
And when integrated, some tests failed.

Comment 15 Mikolaj Izdebski 2021-10-08 10:00:58 UTC
(In reply to Didik Supriadi from comment #14)
> > - running each test in a separate fork (forkCount=1, reuseForks=false
> > settings of surefire); many tests do not clean up contexts properly, this
> > makes the tests much more resilient at the expense of performance. See
> > comment in build.gradle line 84
> Hmm, I need your help. Failed to set reuseForks to false, here's the error:
> 
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test)
> on project rhino: Execution default-test of goal
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed:
> java.lang.reflect.InvocationTargetException:
> org/apache/commons/lang3/StringUtils: org.apache.commons.lang3.StringUtils
> -> [Help 1]

This is a downstream bug in maven-surefire package. I looked into fixing it, but that won't be easy without bundling commons-lang3 and commons-io inside surefire. However you can easily work around the bug by adding the following deps to rhino:
%pom_add_dep org.apache.commons:commons-lang3:3.8.1:test %{name}
%pom_add_dep commons-io:commons-io:2.6:test %{name}

With these dependencies added and reuseForks=false all tests pass for me.
[WARNING] Tests run: 95328, Failures: 0, Errors: 0, Skipped: 2

Comment 16 Didik Supriadi 2021-10-08 12:20:06 UTC
Spec URL: https://didiksupriadi41.fedorapeople.org/rhino.spec
SRPM URL: https://didiksupriadi41.fedorapeople.org/rhino-1.7.13-5.fc34.src.rpm

Done, thank you so much for your help!

Comment 17 Didik Supriadi 2021-10-08 12:23:39 UTC
Built on koji: https://koji.fedoraproject.org/koji/taskinfo?taskID=76912599

Comment 18 Mikolaj Izdebski 2021-10-10 11:48:55 UTC
Package Review
==============

Key:
- = N/A
x = Check
! = Problem
? = Not evaluated


=== Generic reqired items ===

[x] rpmlint must be run on the source rpm and all binary rpms the
    build produces. The output should be posted in the review.

[x] The package must be named according to the Package Naming
    Guidelines.

[x] The spec file name must match the base package %{name}, in the
    format %{name}.spec unless your package has an exemption.

[x] The package must meet the Packaging Guidelines.

[x] The package must be licensed with a Fedora approved license and
    meet the Licensing Guidelines.

[x] The License field in the package spec file must match the actual
    license.

[x] If (and only if) the source package includes the text of the
    license(s) in its own file, then that file, containing the text of
    the license(s) for the package must be included in %license.

[x] The spec file must be written in American English.

[x] The spec file for the package MUST be legible.

[x] The sources used to build the package must match the upstream
    source, as provided in the spec URL. Reviewers should use
    sha256sum for this task as it is used by the sources file once
    imported into git. If no upstream URL can be specified for this
    package, please see the Source URL Guidelines for how to deal with
    this.

[x] The package MUST successfully compile and build into binary rpms
    on at least one primary architecture.

[-] If the package does not successfully compile, build or work on an
    architecture, then those architectures should be listed in the
    spec in ExcludeArch. Each architecture listed in ExcludeArch MUST
    have a bug filed in bugzilla, describing the reason that the
    package does not compile/build/work on that architecture. The bug
    number MUST be placed in a comment, next to the corresponding
    ExcludeArch line.

[x] All build dependencies must be listed in BuildRequires.

[-] The spec file MUST handle locales properly. This is done by using
    the %find_lang macro. Using %{_datadir}/locale/* is strictly
    forbidden.

[x] Packages must NOT bundle copies of system libraries.

[-] If the package is designed to be relocatable, the packager must
    state this fact in the request for review, along with the
    rationalization for relocation of that specific package. Without
    this, use of Prefix: /usr is considered a blocker.

[x] A package must own all directories that it creates. If it does not
    create a directory that it uses, then it should require a package
    which does create that directory.

[x] A Fedora package must not list a file more than once in the spec
    file’s %files listings. (Notable exception: license texts in
    specific situations)

[x] Permissions on files must be set properly. Executables should be
    set with executable permissions, for example.

[x] Each package must consistently use macros.

[x] The package must contain code, or permissible content.

[x] Large documentation files must go in a -doc subpackage. (The
    definition of large is left up to the packager’s best judgement,
    but is not restricted to size. Large can refer to either size or
    quantity).

[x] If a package includes something as %doc, it must not affect the
    runtime of the application. To summarize: If it is in %doc, the
    program must run properly if it is not present.

[-] Static libraries must be in a -static package.

[-] Development files must be in a -devel package.

[-] In the vast majority of cases, devel packages must require the
    base package using a fully versioned dependency: Requires:
    %{name}%{?_isa} = %{version}-%{release}

[x] Packages must NOT contain any .la libtool archives, these must be
    removed in the spec if they are built.

[-] Packages containing GUI applications must include a
    %{name}.desktop file, and that file must be properly installed
    with desktop-file-install in the %install section. If you feel
    that your packaged GUI application does not need a .desktop file,
    you must put a comment in the spec file with your
    explanation.

[x] Packages must not own files or directories already owned by other
    packages. The rule of thumb here is that the first package to be
    installed should own the files or directories that other packages
    may rely upon. This means, for example, that no package in Fedora
    should ever share ownership with any of the files or directories
    owned by the filesystem or man package. If you feel that you have
    a good reason to own a file or directory that another package
    owns, then please present that at package review time.

[x] All filenames in rpm packages must be valid UTF-8.

[x] Packages being added to the distribution MUST NOT depend on any
    packages which have been marked as being deprecated.


=== Generic optional items ===

[-] If the source package does not include license text(s) as a
    separate file from upstream, the packager SHOULD query upstream to
    include it.

[x] The reviewer should test that the package builds in mock.

[x] The package should compile and build into binary rpms on all
    supported architectures.

[!] The reviewer should test that the package functions as
    described. A package should not segfault instead of running, for
    example.

[-] If scriptlets are used, those scriptlets must be sane. This is
    vague, and left up to the reviewers judgement to determine sanity.

[x] Usually, subpackages other than devel should require the base
    package using a fully versioned dependency.

[-] The placement of pkgconfig(.pc) files depends on their usecase,
    and this is usually for development purposes, so should be placed
    in a -devel pkg. A reasonable exception is that the main pkg
    itself is a devel tool not installed in a user runtime, e.g. gcc
    or gdb.

[-] If the package has file dependencies outside of /etc, /bin, /sbin,
    /usr/bin, or /usr/sbin consider requiring the package which
    provides the file instead of the file itself.

[x] The package should contain man pages for binaries/scripts. If it
    doesn’t, work with upstream to add them where they make sense.


=== Java required items  ===

[x] Binary *.class and *.jar files from upstream releases MUST NOT be
    used during build of Fedora packages and they MUST NOT be included
    in binary RPM.

[x] All architecture-independent JAR files MUST go into %{_javadir} or
    its subdirectory.

[x] Java packages MUST BuildRequire their respective build system:

[x] Java binary packages MUST have transitive Requires on:
    java-headless, java, java-devel

[!] Java binary packages MUST have transitive Requires on:
    javapackages-filesystem, javapackages-tools

[x] If javadoc documentation is generated it MUST be installed into a
    directory of %{_javadocdir}/%{name} as part of %{name}-javadoc
    subpackage

[-] Compatibility packages MUST be named in the same way as original
    except addition of version to package name,

[-] Any compatibility JAR and POM files MUST be versioned.


=== Java optional items  ===

[-] If the package provides a single JAR file installed filename
    SHOULD be %{name}.jar.

[x] If the package provides multiple JAR files, they SHOULD be
    installed in a %{name} subdirectory.

[x] Applications wishing to provide a convenient method of execution
    SHOULD provide a wrapper script in %{_bindir}. Packages SHOULD use
    %jpackage_script to create these wrapper scripts.


=== rpmlint output ===
rhino-javadoc.noarch: W: package-with-huge-docs:  99%
rhino-javadoc.noarch: E: files-duplicated-waste 324916
rhino-javadoc.noarch: W: files-duplicate /usr/share/javadoc/rhino/jquery/jquery-3.5.1.js /usr/share/javadoc/rhino/jquery/external/jquery/jquery.js
rhino-javadoc.noarch: W: files-duplicate /usr/share/licenses/rhino/LICENSE.txt /usr/share/licenses/rhino-engine/LICENSE.txt:/usr/share/licenses/rhino-runtime/LICENSE.txt
rhino-javadoc.noarch: W: files-duplicate /usr/share/licenses/rhino/NOTICE.txt /usr/share/licenses/rhino-engine/NOTICE.txt:/usr/share/licenses/rhino-runtime/NOTICE.txt
rhino-javadoc.noarch: W: file-not-utf8 /usr/share/javadoc/rhino/member-search-index.zip
rhino-javadoc.noarch: W: file-not-utf8 /usr/share/javadoc/rhino/package-search-index.zip
rhino-javadoc.noarch: W: file-not-utf8 /usr/share/javadoc/rhino/type-search-index.zip


=== Issues ===
1. rhino.noarch package which provides /usr/bin/rhino does not require
   javapackages-tools. This prevents /usr/bin/rhino from running.
   Missing manual Requires must be added to fix this issue.


====================
*** NOT APPROVED ***
====================

Comment 19 Didik Supriadi 2021-10-11 14:03:06 UTC
Apparently, the tests failed in i686 architecture as you can see here[1].
I think I should use ExcludeArch in this case.

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=77069637

Comment 20 Mikolaj Izdebski 2021-10-11 14:26:29 UTC
From my PoV adding missing Requires on javapackages-tools is the only blocker for this review.
Once you add the Requires I'll approve this review.

Comment 22 Didik Supriadi 2021-10-11 14:42:53 UTC
I forgot to upload the new spec, now it's on the server ^

Comment 23 Mikolaj Izdebski 2021-10-12 17:50:48 UTC
I confirm that the missing Requires was added.
The review is approved.

Comment 24 Didik Supriadi 2021-10-12 18:03:26 UTC
Thank you!

Comment 25 Didik Supriadi 2021-10-13 09:09:49 UTC
the package is unretired: https://pagure.io/releng/issue/10341


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