#1129592 jarwrapper: Support binfmt_misc with systemd-binfmt

#1129592#5
Date:
2026-03-03 17:18:21 UTC
From:
To:
Dear Maintainer,

When systemd is installed, systemd-binfmts unregisters binfmt_misc
formats registered by update-binfmts (from the binfmt-support
package), including jarwrapper.  I reported this against systemd in
Bug 1127314.

Since that bug hasn't see any activity, I thought it might be worth
fixing from this end by adding systemd-binfmt support to jarwrapper.
This can be accomplished by installing the attached jarwrapper.binfmt
to /usr/lib/binfmt.d.  Note that it does not run jardetect, which
means that attempting to execute a jar file without
META-INF/MANIFEST.MF would cause

    Can't open /tmp/tmp.XXXXXXXXXX/META-INF/MANIFEST.MF: No such file or directory.
    Can't open /tmp/tmp.XXXXXXXXXX/META-INF/MANIFEST.MF: No such file or directory.
    Error: Invalid or corrupt jarfile /path/to/bad.jar

instead of

    invalid file (bad magic number): Exec format error

If this is unacceptable, we could consider alternative
implementations.

Once binfmt.d support is added, I believe `Depends: binfmt-support`
could also be relaxed to `Depends: binfmt-support | systemd` since
either can perform binfmt_misc registration.

Thanks for considering,
Kevin