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

Re: linking binfmt_misc with mime-types



>Could I clarify some stuff please?
>
>Are we proposing that all mime-types have binfmt_misc setup? Does that mean,
>the kernel will be able to `run' any file in mailcap? Is that what we really
>want?

Daniel Burrows proposed that only certain entries would get executed,
He suggested that it would be up to the package maintainer to decide
if his entry did/didn't have a binfmt_misc entry. Another alternative
is that this is entirely up to the system adminstrator to decide.

For instance, you could implement the original proposal that just
installs the entries "as is" from a config file (or directory). This
could run another program, with an additional parameter (are parameters
allowed?) that specificies the MIME type. This program would parse
/etc/mailcap and run the appropriate program. Sample entries could be
provided for standard types, to be installed if and only if the system
administrator wants to.

As for my opinion? I am reluctant to use binfmt_misc at all, and
prefer more portable solutions ;-).

>I am neither fore, nor against this idea. On the one hand it would be quite
>cool, entering the name of an html document on the command line and it loading
>in lynx. On the other hand it goes against the Unix philosophy a bit,
>documents are programs are documents.

Agreed. I would always be reluctant to make all my documents executable
in order to get this to work...

However, if you are going to implement binfmt_misc support, I felt
that it would be better if it could somehow use the information
in /etc/mailcap, that is already maintained.

>Another question is are their mime-types for all the programs we might want to
>run in this way? The programs I can think of off-hand, are Java, DOS EXE, and
>Windows EXE, are there any others? If we go with the ability to run documents
>like images and so on, do we have all the mime-types? Are we going to have to
>invent new mime-types? Is that a bad thing to do?

The only real problem I see with this, is that I don't want to
accidently select a DOS EXE file in lynx, eg format.exe, and have that
automatically execute...

However, it might be better in this case to go back to the original
proposal, and directly hardcode the name of the executable in the
binfmt_misc config file, as it is unlikely there will need to be MIME
types for DOS EXE, Windows EXE, etc.

In /etc/mime.types, there is an entry:
application/x-java
so don't underestimate the number of MIME types, either.

>Some more questions. Is it possible to recognise an html file by a couple of
>magic numbers at the beginning? Most html starts <html> or <HTML>, but it is
>not certian that it will look like this. Another thought is the possiblilty of
>running perl scripts without the bang path, but then how would the shell tell
>it is a perl script.
>
>If we put loads of entries into binfmt_misc are we likely to fill some kernel
>data table? What happens if it overloads? Do we significantly affect the
>performance of the system? If the kernel is checking each file against a list
>of magic numbers will it take a long time to run a file? (Probably not the
>kernel is fast, and most files we will run will be ELF, which is probably
>checked first.)
>
>This is not user independant is it? The system can not be set so that one user
>has support for running Java/JPEGs from the command line, and another does
>not?

These are questions I can't answer. I seriously doubt the kernel will be
able to reliably distinguish all file types though - especially
ones like HTML.
-- 
Brian May <bam@snoopy.apana.org.au>


Reply to: