Bug#661632: javahelper: jh_depends determines incorrect class version on sparc

Kai Ruschenburg kairu at web.de
Tue Feb 28 18:08:09 UTC 2012


Package: javahelper
Version: 0.32
Severity: normal
Tags: patch

Hi,

when packaging Java programs on sparc (using the sources fetched by apt-get
source), on some programs (e.g. sat4j) this warning is printed:

$ debuild
[...]
jh_depends -i
Warning: Class version too new to recognise (88), might not run with any JVMs
[...]

This is caused by hd in the function getclassversion() in jh_depends.

The output of hd seems to depend on the endianness of the architecture.
Therefore probably not only sparc, but all big-endian architectures are
affected.

Changing line 37 from
new=`hd -s 7 -n 1 -d "$i" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'`
to
new=`hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "$i" | dc`
should fix this.

Some examples:

$ cat Test.java
public class Test {
    public static void main(String[] args) {
    }
}
$ javac -source 1.3 -target 1.3 Test.java
$ hd -s 7 -n 1 -d "Test.class" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'
32
$ hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "Test.class" | dc
47
$ javac -source 1.4 -target 1.4 Test.java
$ hd -s 7 -n 1 -d "Test.class" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'
88
$ hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "Test.class" | dc
48
$ javac -source 1.5 -target 1.5 Test.java
$ hd -s 7 -n 1 -d "Test.class" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'
44
$ hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "Test.class" | dc
49
$ javac -source 1.6 -target 1.6 Test.java
$ hd -s 7 -n 1 -d "Test.class" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'
00
$ hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "Test.class" | dc
50

Best regards

Kai


-- System Information:
Debian Release: 6.0.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: sparc (sparc64)

Kernel: Linux 2.6.32-5-sparc64-smp (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages javahelper depends on:
ii  bsdmainutils            8.0.13           collection of more utilities from 
ii  dctrl-tools             2.14.5           Command-line tools to process Debi
ii  debhelper               8.0.0            helper programs for debian/rules
ii  devscripts              2.10.69+squeeze2 scripts to make the life of a Debi
ii  dpkg-dev                1.15.8.12        Debian package development tools
ii  fastjar                 2:0.98-3         Jar creation utility
ii  libarchive-zip-perl     1.30-3           Perl module for manipulation of ZI

javahelper recommends no packages.

Versions of packages javahelper suggests:
pn  cvs                       <none>         (no description available)
ii  gawk                      1:3.1.7.dfsg-5 GNU awk, a pattern scanning and pr
pn  tofrodos                  <none>         (no description available)

-- no debconf information
-------------- next part --------------
--- jh_depends.orig	2010-07-04 10:35:16.000000000 +0200
+++ jh_depends	2012-02-25 15:28:43.344986707 +0100
@@ -34,7 +34,7 @@
 	current=$1
 	classes="$2"
 	for i in `find "$classes" -name "*.class"`; do
-		new=`hd -s 7 -n 1 -d "$i" | sed -n '2s/.*\([^ ][^ ]\) *$/\1/p'`
+		new=`hexdump -s 6 -n 2 -e '/1 "%u "' -e '/2 " r 256 * + p"' "$i" | dc`
 		if (( $current < $new )); then
 			current=$new
 		fi


More information about the pkg-java-maintainers mailing list