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 1994935

Summary: jansi: missing output colorization
Product: Red Hat Enterprise Linux 9 Reporter: Martin Kyral <mkyral>
Component: jansiAssignee: Marián Konček <mkoncek>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kyral <mkyral>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: mizdebsk
Target Milestone: betaKeywords: Triaged
Target Release: 9.0 BetaFlags: pm-rhel: mirror+
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
Description of problem:

with maven-3.6.3-8.el9, the output of the reproducer gets colorized. With maven-3.6.3-11.el9, the colours are missing.

Version-Release number of selected component (if applicable):


How reproducible:
Manually


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Mikolaj Izdebski 2021-08-18 09:22:22 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

Comment 4 Mikolaj Izdebski 2021-08-19 13:59:42 UTC
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.

Comment 5 Mikolaj Izdebski 2021-08-19 14:12:01 UTC
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.

Comment 7 Mikolaj Izdebski 2021-08-20 07:33:21 UTC
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.

Comment 8 Mikolaj Izdebski 2021-08-20 07:52:30 UTC
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).