Bug#539315: executable-not-elf-or-script test should know about jars
On Sat, Jun 09, 2012 at 03:58:26PM +0100, Colin Watson wrote:
> I tried to arrange that the general design should be amenable to a
> non-Linux implementation. That said, it's true that nobody has so far
> got round to coming up with one. I would expect it to be fairly trivial
> to write a Hurd implementation, seeing as binfmt_misc is really just a
> special case of translators; I don't know what it would take to
> implement it on kFreeBSD.
An alternative, incidentally, would be to use a small shim which looks
something like this (entirely untested):
#! /bin/bash
set -e
NL="
"
case $(uname) in
Linux)
exec "$@"
;;
*)
shopt -s execfail
OLD_IFS="$IFS"
IFS="$NL"
RET=0
for interpreter in $(update-binfmts --find "$1"); do
exec -a "$1" "$interpreter" "$@" || RET=$?
done
exit "$RET"
;;
esac
That way you could take advantage of binfmt-support's existing interface
for registering binary formats, which is fairly well-tested by this
point, without having to sacrifice non-Linux support.
--
Colin Watson [cjwatson@debian.org]
Reply to: