Bug 1169509

Summary: file: report full java version for 1.7 and 1.8 class files
Product: Red Hat Enterprise Linux 6 Reporter: Nathan Galvin <ngalvin>
Component: fileAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: Marek Marusic <mmarusic>
Severity: high Docs Contact:
Priority: high    
Version: 6.6CC: mmarusic, ngalvin, szidek, thoger
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: file-5.04-22.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1278737 1309878 (view as bug list) Environment:
Last Closed: 2016-05-10 19:47:16 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:
Bug Depends On:    
Bug Blocks: 1172231, 1254457, 1269913, 1309878    

Description Nathan Galvin 2014-12-01 21:26:09 UTC
Description of problem:
If you compile using Java SE 6, file will display:
    compiled Java class data, version 48.0 (Java 1.4)
Note the "(Java 1.4)" at the end.

If you compile with Java SE 7, file will display:
    compiled Java class data, version 51.0
Note the missing ("Java 1.7)" at the end.

Version-Release number of selected component (if applicable):
java-1.7.0-ibm-1.7.0.7.1-1jpp.1.el6_5.x86_64

How reproducible:
Very

Steps to Reproduce:
1. install java
2. complile java
3. run 'file' command against class files

Actual results:
No java version reported

Expected results:
Java verion to be reported as part of the output.

Additional info:

Comment 1 Nathan Galvin 2014-12-01 21:28:12 UTC
(In reply to Nathan Galvin from comment #0)
> Description of problem:
> If you compile using Java SE 6, file will display:
>     compiled Java class data, version 48.0 (Java 1.4)
> Note the "(Java 1.4)" at the end.
> 
> If you compile with Java SE 7, file will display:
>     compiled Java class data, version 51.0
> Note the missing ("Java 1.7)" at the end.
> 
> Version-Release number of selected component (if applicable):
> java-1.7.0-ibm-1.7.0.7.1-1jpp.1.el6_5.x86_64
> 
> How reproducible:
> Very
> 
> Steps to Reproduce:
> 1. install java
> 2. complile java
> 3. run 'file' command against class files

Should read

Steps to Reproduce:
1. install java
2. complile using java
3. run 'file' command against class files

> 
> Actual results:
> No java version reported
> 
> Expected results:
> Java verion to be reported as part of the output.
> 
> Additional info:

Comment 3 Tomas Hoger 2014-12-02 19:23:50 UTC
This isn't java bug, but file bug.  The solution is exactly what is described in the initial description of the attached support case.  cafebabe magic file needs the following two rules:

>>4 belong      0x0033      (Java 1.7)
>>4 belong      0x0034      (Java 1.8)

Their addition changes output form:

$ file java{6,7,8}.class
java6.class: compiled Java class data, version 50.0 (Java 1.6)
java7.class: compiled Java class data, version 51.0
java8.class: compiled Java class data, version 52.0

to:

$ file java{6,7,8}.class -m magic 
java6.class: compiled Java class data, version 50.0 (Java 1.6)
java7.class: compiled Java class data, version 51.0 (Java 1.7)
java8.class: compiled Java class data, version 52.0 (Java 1.8)

The issue does not seem to be fixed upstream:

https://github.com/file/file/blob/master/magic/Magdir/cafebabe

I'm sure Jan can get this upstream rather easily.

Comment 4 Jan Kaluža 2015-02-05 07:26:12 UTC
Proposed upstream: http://bugs.gw.com/view.php?id=422

Comment 13 errata-xmlrpc 2016-05-10 19:47:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-0760.html