[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suggestion: binfmt_misc handling



In article <[🔎] 19991003100602.A23129@bluegreen.dhis.org> you write:
>  Basically what you can do is create a directory called /etc/binfmt_misc and
>put a bunch of files in it; each file should be a series of lines where each
>line is a directive for the binfmt_misc registration file in /proc.  So the
>incantation for Java is:
>:Java:M::\xca\xfe\xba\xbe::/usr/bin/javawrapper:
>  (assuming that /usr/bin/javawrapper does something sensible), and for JPEG
>(yes, this is a really dumb usage of binfmt_misc, but it's the only other
> magic number I could come up with offhand):
>
>:JPEG:M::0xffd8::/usr/X11R6/bin/display:
>:JPEG-JFIF:M::JFIF::/usr/X11R6/bin/display:
>:JPEG-HSI:M::hsi1::/usr/X11R6/bin/display:
>
>  Comments are also supported (by beginning a line with '#')
>
>  Packages such as Wine, Kaffe, dosemu, and perhaps Frotz would drop a file
>into this directory announcing their support of a binary format.  The files
>wouldn't actually be interpreted unless this init.d script is installed; I
>assume that someone is going to claim this is a security hazard, so I thought
>I'd point that out :P

I have two comments:

1. Where would you install the files into this directory?

Ideally, IMHO, it would be possible to directly embed the config file
into the deb file, with the full pathname under /etc/bin_fmt.

However, in this case, what would happen with duplicates? eg what will
happen when many packages that provide Java, all provide their own
(possibly different) entry under /etc/bin_fmt?



2. Suggestion: Would it be possible to somehow integrate this with
/etc/mailcap, which already has good support in packages? There are
different ways you could do this, eg have in the config file lines that
look like:

:Java:M::\xca\xfe\xba\xbe::application/x-java:
:JPEG:M::0xffd8::image/jpeg:
:JPEG-JFIF:M::JFIF::image/jpeg:
:JPEG-HSI:M::hsi1::image/jpeg:

Where the last field is replaced with the appropriate command line from
the /etc/mailcap file. Not that there currently is a mailcap entry (at
least on my slink system) for java...

This file could potentially be used for more applications then just the
kernel - any program that wants to map the file to a MIME type. (Apache
already does this - is this any better? I suspect Apache's is hardcoded,
but not sure).

I think that this could be done with similar structure as originally
proposed.
-- 
Brian May <bam@snoopy.apana.org.au>


Reply to: