Bug 1994935
Summary: | jansi: missing output colorization | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Martin Kyral <mkyral> |
Component: | jansi | Assignee: | Marián Konček <mkoncek> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Martin Kyral <mkyral> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 9.0 | CC: | mizdebsk |
Target Milestone: | beta | Keywords: | Triaged |
Target Release: | 9.0 Beta | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | jansi-2.3.3-5.el9 maven-3.6.3-13.el9 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-12-07 22:04:56 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: | |||
Deadline: | 2021-08-23 |
Description
Martin Kyral
2021-08-18 08:17:10 UTC
The cause is that there is a mismatch between location of native .so library and the code, which expects the library in a different location. Reproducer: # cat rep.java class rep { public static void main(String[] args) { org.fusesource.jansi.internal.JansiLoader.initialize(); } } # /usr/lib/jvm/java-11-openjdk/bin/javac -cp /usr/lib/java/jansi/jansi.jar rep.java # /usr/lib/jvm/java-11-openjdk/bin/java -cp /usr/lib/java/jansi/jansi.jar:. rep Expected output: no output; exit code is 0 Actual output: Exception in thread "main" java.lang.RuntimeException: Unable to load jansi native library at org.fusesource.jansi.internal.JansiLoader.initialize(JansiLoader.java:62) at rep.main(rep.java:3) Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib] at org.fusesource.jansi.internal.JansiLoader.loadJansiNativeLibrary(JansiLoader.java:338) at org.fusesource.jansi.internal.JansiLoader.initialize(JansiLoader.java:60) ... 1 more Intended code change: Fix the library location and/or the code that looks for library file A new gating test is needed; the above reproducer should be turned into a test and made a mandatory gating test No documentation changes are needed. Actions to pre-verify the fix: - make sure that a gating test was implemented, it looks sane, was ran and passed - check whether other existing gating tests passed - manually check whether package follows Java packaging guidelines wrt. JNI library installation: https://docs.fedoraproject.org/en-US/packaging-guidelines/Java/#JNI - JAR files using JNI or containing JNI shared objects themselves MUST be placed in %{_jnidir} and MAY be symlinked to %{_libdir}/%{name}. - JNI shared objects MUST be placed in %{_libdir}/%{name} - check that running "mvn" in a terminal produces colorized output Actions to verify the fix: - check that running "mvn" (without arguments) in a terminal produces colorized output - check whether all gating tests (existing and newly implemented) passed - check whether Maven functional tests passed Gating test was committed in https://gitlab.com/redhat/centos-stream/rpms/jansi/-/merge_requests/8 It failed as expected: http://artifacts.osci.redhat.com/testing-farm/7dbf12ff-3aca-4369-bc34-0a27dacb306b/ Commit: https://gitlab.com/redhat/centos-stream/rpms/jansi/-/commit/931c4c2679b4448ebce73d905869a399552de5aa Gating test was implemented, looks sane and passed. The build follows Java packaging guidelines wrt. JNI library installation Failed test: Running "mvn" does *not* produce colorized output. I debugged this a little and found out that /usr/bin/mvn shell script sets "library.jansi.path property to ${MAVEN_HOME}/lib/jansi-native, which overrides jansi built-in library search paths. The following merge requests address this issue: https://gitlab.com/redhat/centos-stream/rpms/jansi/-/merge_requests/10 https://gitlab.com/redhat/centos-stream/rpms/maven/-/merge_requests/6 Tested jansi-2.3.3-5.el9 together with maven-3.6.3-13.el9 Running "mvn" produces colorized console output now. The new build still follows Java packaging guidelines wrt. JNI library installation, except for libjansi.so file installation, which is installed into /usr/lib, not %{_libdir}, but this is fine per Java multilib exemption granted by FESCo https://pagure.io/fesco/issue/961 Still waiting for gating tests to pass. All gating test for jansi-2.3.3-5.el9 and maven-3.6.3-13.el9 passed. That makes this bug is pre-verified (sanity-only as no functional tests were ran). |