← Back to team overview

openjdk team mailing list archive

Bug#855858: [openjdk-8-jre] jexec'ing .jar-files through binfmt doesn't work

 

On Wed, 2017-02-22 at 15:34 +0100, Steffen Weinhart wrote:
> When trying to execute a .jar-file (x-bit is set) via terminal, I get the
> error 'invalid file (bad magic number): Exec format error'. The same
> procedure with the same .jar used to work in an earlier version of openjdk
> (about 2 months ago, already openjdk-8).

The same issue occurs in
<https://bugs.launchpad.net/ubuntu/+source/ditaa/+bug/1498832>.  It
appears to occur when there is a version-mismatch between jexec and
the jar.  For example, with ditaa 0.10+ds1-1.1

/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jexec /usr/bin/ditaa

works while

/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec /usr/bin/ditaa

fails with `invalid file (bad magic number): Exec format error`.

/usr/bin/jarwrapper /usr/bin/ditaa

also works.  Note that whether executing a jar file works is dependent
on the order that jarwrapper and the openjdk-*-jre-headless packages
were configured.  Whichever package was configured first is the one
used used by binfmt_misc.

Note that the conflicting jar registrations was also mentioned in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=136993#82

I contend that if jexec can not handle jars from different Java
versions, then it should not be registered with binfmt_misc.  If it
must be, for compatibility, then perhaps binfmt-support should have a
priority system like alternatives so that jarwrapper can be registered
with a higher priority?

Cheers,
Kevin