Bug 1258039

Summary: java-1.8.0-openjdk-devel has wrong priority (lower than 1.6 and 1.7) messing up alternatives
Product: Red Hat Enterprise Linux 6 Reporter: Charles Butterfield <cb20777>
Component: java-1.8.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.7CC: me, sbaiduzh
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-30 11:18:37 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:

Description Charles Butterfield 2015-08-28 17:58:15 UTC
Description of problem:java-1.8.0-openjdk-devel has wrong priority  (lower than 1.6 and 1.7) messing up alternatives.  See the sample output below.

Due to another bug (see https://bugzilla.redhat.com/show_bug.cgi?id=1258036) we get an unwanted copy of obsolete Java packages in addition to our explicitly installed Java-1.8.  Sadly the priorities are all messed up with both Java 1.6 and 1.7 being higher priority than 1.8.  So the unwanted Java versions win the alternatives contest (initially and periodically on yum update).

Sadly the number of digits in the priority field varies from 4 to 6.

See the following:

$ sudo alternatives --display java | grep -v slave
java - status is manual.
 link currently points to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.el6_7.x86_64/jre/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.el6_7.x86_64/jre/bin/java - priority 1851
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.el6_7.x86_64-debug/jre/bin/java - priority 1851
/usr/lib/jvm/jre-1.5.0-gcj/bin/java - priority 1500
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java - priority 16000
/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java - priority 170085
Current `best' version is /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java.

Comment 2 Deepak Bhole 2015-08-31 13:41:26 UTC
Jiri, didn't we fix this in 6.7?

Comment 4 jiri vanek 2015-09-21 06:13:01 UTC
Anyway  for 6.8 the priority should be aligned to "normal"  value.

Comment 5 Charles Butterfield 2015-09-27 15:44:47 UTC
Jiri - Thanks for your posts.  Some followon

1) I can't get the URLs above to work, they just (after some redirection) end up with "Sorry, We could not find pkgs.devel.redhat.com".  I have an RHEL support account, do I need to use that (somehow?) to access these links?

2) My target system is at RHEL 6.7  (actually the ones of interest are CentOS 6.7).  Any suggestion on getting my hands on a 6.7 patch.  I can rebuild the RPM myself if need be if I could see the lines to be patched.  Perhaps all of that is revealed in the links I can't access.

Thanks
-- Charlie B

Comment 6 jiri vanek 2015-09-29 12:26:51 UTC
(In reply to Charles Butterfield from comment #5)
> Jiri - Thanks for your posts.  Some followon
> 
> 1) I can't get the URLs above to work, they just (after some redirection)
> end up with "Sorry, We could not find pkgs.devel.redhat.com".  I have an
> RHEL support account, do I need to use that (somehow?) to access these links?

Sorry I overlooked. Those urls are not  public. I made the comment private. 
> 
> 2) My target system is at RHEL 6.7  (actually the ones of interest are
> CentOS 6.7).  Any suggestion on getting my hands on a 6.7 patch.  I can
> rebuild the RPM myself if need be if I could see the lines to be patched. 
> Perhaps all of that is revealed in the links I can't access.

I can not put this change to 6.7. It is surprisingly severe change for buildroots.
If you wont to live on with your rebuilt  pacakge, then yo need to go with:

--- a/java-1.8.0-openjdk.spec
+++ b/java-1.8.0-openjdk.spec
@@ -121,14 +121,8 @@
 %global aarch64_updatever 51
 %global aarch64_buildver b16
 %global aarch64_changesetid aarch64-jdk8u51-b16
-# in normal world,  priority must be 7 digits in total
-# however, before this package will provide javac and java-devel
-# the priority is kept on 0, but 117545 appeared
-# https://bugzilla.redhat.com/show_bug.cgi?id=1175457#c33
-# the goal now is to proviide priority > gcj and < other jdks
-# once devel virtualprovides are back, set normal priority and remove this comments
-#%global priority        00000%{updatever}
-%global priority        18%{updatever}
+# priority must be 7 digits in total
+%global priority        18000%{updatever}
 %global javaver         1.8.0
 
 # parametrized macros are order-sensitive
@@ -684,7 +678,7 @@ Requires: %{name}-headless%1 = %{epoch}:%{version}-%{release}
 
 Name:    java-%{javaver}-%{origin}
 Version: %{javaver}.%{updatever}
-Release: 2.%{buildver}%{?dist}
+Release: 3.%{buildver}%{?dist}
 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons,
 # and this change was brought into RHEL-4.  java-1.5.0-ibm packages
 # also included the epoch in their virtual provides.  This created a
@@ -1004,11 +998,9 @@ if [ %{include_debug_build} -eq 0 -a  %{include_normal_build} -eq 0 ] ; then
 fi
 %setup -q -c -n %{uniquesuffix ""} -T -a 0
 # https://bugzilla.redhat.com/show_bug.cgi?id=1189084
-# temorarily reset to length of 4 dont fix unles syou know what you are doing.
-# fix back to 7 once javac provides are back
 prioritylength=`expr length %{priority}`
-if [ $prioritylength -ne 4 ] ; then
- echo "priority must be 4 digits in total, violated"
+if [ $prioritylength -ne 7 ] ; then
+ echo "priority must be 7 digits in total, violated"
  exit 14
 fi
 # For old patches



Which is already presented in 6.8.

Comment 7 Charles Butterfield 2015-09-30 00:48:10 UTC
Thanks!

Comment 8 jiri vanek 2015-09-30 11:18:37 UTC
Ok. Looks like it helped:)