Bug 918172

Summary: File /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/server/classes.jsa left after package removal
Product: Red Hat Enterprise Linux 6 Reporter: Lukáš Zachar <lzachar>
Component: java-1.7.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: jan.kratochvil, nyh, ptisnovs
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: 2013-04-23 05:49:04 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 Lukáš Zachar 2013-03-05 16:09:49 UTC
Description of problem:

The creation of the file classes.jsa has been added to the %post phase of the rpm (for its purpose see bug 513605 and bug 878181).
But the file is kept when the package itself is removed (as it is not owned by any package) and thus blocks the deletion of the directory tree.
IMHO the deletion should be managed by %postun (for the case of package removal). 
During the package update the file is regenerated, so no harm is done.

Version-Release number of selected component (if applicable):
java-1.7.0-openjdk-1.7.0.9-2.3.7.1.el6_3.x86_64

How reproducible:
always

Steps to Reproduce:
1. rpm -e java-1.7.0-openjdk
2. ls /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/server/classes.jsa
3.
  
Actual results:
The file and its directory tree is left after the removal.

Expected results:
No leftovers

Additional info:

Comment 1 jiri vanek 2013-03-14 10:04:24 UTC
damn. Yes this file have to be removed in postun, but only for removing of package, not for update. Because it is not "just regenerated" in post, but better "enriched" during post. So the fix in postun will be:

%ifarch %{jit_arches}
  if [ $1 -eq 0 ]
  then
    #see https://bugzilla.redhat.com/show_bug.cgi?id=918172
    f="%{_jvmdir}/%{jredir}/lib/%{archinstall}/server/classes.jsa"
    if [ -f "$f" ]   
      rm -rf "$f"
    fi
  fi
%endif

Comment 2 jiri vanek 2013-03-18 11:02:44 UTC
Missing then. Otherwise QA is ok with this approach.

%ifarch %{jit_arches}
  if [ $1 -eq 0 ]
  then
    #see https://bugzilla.redhat.com/show_bug.cgi?id=918172
    f="%{_jvmdir}/%{jredir}/lib/%{archinstall}/server/classes.jsa"
    if [ -f "$f" ]
    then
      rm -rf "$f"
    fi
  fi
%endif

Comment 3 jiri vanek 2013-03-18 14:21:29 UTC
Ok one more update:

%ifarch %{jit_arches}
  if [ $1 -eq 0 ]
  then
    #see https://bugzilla.redhat.com/show_bug.cgi?id=918172
    f="%{_jvmdir}/%{jrelnk}/lib/%{archinstall}/server/classes.jsa"
    if [ -f "$f" ]
    then
      rm -rf "$f"
    fi
  fi
%endif

the usage of jrelnk instead of jredir is important to prevent inconsistency between update with/without changed buildversion (as release is not projected into final directory name)

Comment 4 jiri vanek 2013-03-22 15:12:04 UTC
*** Bug 922910 has been marked as a duplicate of this bug. ***

Comment 6 jiri vanek 2013-03-25 17:13:01 UTC
Builds with fix of this were pushed to fedora.
if they will pass theirs usual QA, I'm for inclusion into next CPU for Rhel
http://pkgs.fedoraproject.org/cgit/java-1.7.0-openjdk.git/commit/?id=89e2aea2f9880efd4ad773ef9dc566225c9ae9ef

Comment 7 Nadav Har'El 2013-04-07 12:36:02 UTC
Have the same problem in Fedora: After the update *today* (two weeks after the above comment) to java-1.7.0-openjdk-1.7.0.17-2.3.8.3.fc18.x86_64 I'm still left with the unowned file:

-r--r--r--. 1 root root 25M Mar 18 09:14 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/server/classes.jsa

Comment 8 jiri vanek 2013-04-08 07:25:42 UTC
Yes. They are left. It was my error, and I'm deeply sorry.
 those: 
java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/server/classes.jsa *will* left.
But all *next*  eg:
java-1.7.0-openjdk-1.7.0.17.x86_64/jre/lib/amd64/server/classes.jsa will not left enymore.

I do not want to add possibly unsafe scriplet which will remove old (== already not owned) file.