Bug 238088

Summary: gjavah should do output comparison
Product: [Fedora] Fedora Reporter: Thomas Fitzsimmons <fitzsim>
Component: gccAssignee: Tom Tromey <tromey>
Status: CLOSED INSUFFICIENT_DATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: patrickm, triage
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-07 01:34:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
class defining a native method none

Description Thomas Fitzsimmons 2007-04-27 02:03:12 UTC
Sun's javah defaults to always creating the header file, so gjavah should too. 
To reproduce the problem, try this:

ecj TestJavah.java
gjavah -classpath . TestJavah
cat TestJavah.h

TestJavah.h is empty.  With Sun's javah TestJavah.h declares Java_TestJavah_test.

Comment 1 Thomas Fitzsimmons 2007-04-27 02:03:12 UTC
Created attachment 153567 [details]
class defining a native method

Comment 2 Thomas Fitzsimmons 2007-04-27 02:04:58 UTC
This bug causes problems with the libgcj build; even when it is configured with
--enable-regen-headers the GNU Classpath JNI headers are not regenerated.


Comment 3 Tom Tromey 2007-04-27 18:41:07 UTC
Note that 'javah' without -force still won't make a header if it already exists.
That probably affects the classpath build as well.


Comment 4 Thomas Fitzsimmons 2007-04-27 18:46:20 UTC
My testing shows that it does create a header even if the output file already
exists:

$ ls
TestJavah.class  TestJavah.java
$ touch TestJavah.h
$ ls
TestJavah.class  TestJavah.h  TestJavah.java
$ /usr/lib/jvm/java-1.5.0-sun.x86_64/bin/javah TestJavah
$ cat TestJavah.h 
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class TestJavah */

#ifndef _Included_TestJavah
#define _Included_TestJavah
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     TestJavah
 * Method:    test
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_TestJavah_test
  (JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif


Comment 5 Thomas Fitzsimmons 2007-04-27 18:49:31 UTC
Actually, it seems that Sun's javah compares what's already in the output file
with what it intends to write.  If they're the same, it doesn't write anything,
if they're different, it overwrites the existing file.


Comment 6 Thomas Fitzsimmons 2007-04-27 18:53:10 UTC
$ rm TestJavah.h
$ touch TestJavah.h
$ ls -l --full-time
total 8
-rw-rw-r-- 1 fitzsim fitzsim 207 2007-04-26 22:25:49.000000000 -0400 TestJavah.class
-rw-rw-r-- 1 fitzsim fitzsim   0 2007-04-27 14:48:09.000000000 -0400 TestJavah.h
-rw-rw-r-- 1 fitzsim fitzsim  49 2007-04-26 21:56:12.000000000 -0400 TestJavah.java
$ /usr/lib/jvm/java-1.5.0-sun.x86_64/bin/javah TestJavah
$ ls -l --full-time
total 12
-rw-rw-r-- 1 fitzsim fitzsim 207 2007-04-26 22:25:49.000000000 -0400 TestJavah.class
-rw-rw-r-- 1 fitzsim fitzsim 370 2007-04-27 14:48:21.000000000 -0400 TestJavah.h
-rw-rw-r-- 1 fitzsim fitzsim  49 2007-04-26 21:56:12.000000000 -0400 TestJavah.java
$ /usr/lib/jvm/java-1.5.0-sun.x86_64/bin/javah TestJavah
$ ls -l --full-time
total 12
-rw-rw-r-- 1 fitzsim fitzsim 207 2007-04-26 22:25:49.000000000 -0400 TestJavah.class
-rw-rw-r-- 1 fitzsim fitzsim 370 2007-04-27 14:48:21.000000000 -0400 TestJavah.h
-rw-rw-r-- 1 fitzsim fitzsim  49 2007-04-26 21:56:12.000000000 -0400 TestJavah.java

The timestamp is the same in the last two runs.  Adding whitespace to the header
then re-running javah overwrites the header again.

The -force option cause javah to skip the proposed output/output file comparison
and just always overwrite the file.


Comment 7 Bug Zapper 2008-04-04 00:18:14 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 8 Bug Zapper 2008-05-07 01:34:49 UTC
This bug has been in NEEDINFO for more than 30 days since feedback was
first requested. As a result we are closing it.

If you can reproduce this bug in the future against a maintained Fedora
version please feel free to reopen it against that version.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp