Bug 238088 - gjavah should do output comparison
gjavah should do output comparison
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Tromey
bzcl34nup
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-26 22:03 EDT by Thomas Fitzsimmons
Modified: 2014-08-11 01:46 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-06 21:34:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
class defining a native method (49 bytes, text/x-java)
2007-04-26 22:03 EDT, Thomas Fitzsimmons
no flags Details

  None (edit)
Description Thomas Fitzsimmons 2007-04-26 22:03:12 EDT
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-26 22:03:12 EDT
Created attachment 153567 [details]
class defining a native method
Comment 2 Thomas Fitzsimmons 2007-04-26 22:04:58 EDT
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 14:41:07 EDT
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 14:46:20 EDT
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 14:49:31 EDT
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 14:53:10 EDT
$ 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-03 20:18:14 EDT
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-06 21:34:49 EDT
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

Note You need to log in before you can comment on or make changes to this bug.