[Top][All Lists]

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

Re: C file recoginzed as image file

From: Juanma Barranquero
Subject: Re: C file recoginzed as image file
Date: Sun, 7 Jan 2007 20:20:48 +0100

On 1/6/07, Jason Rumney <address@hidden> wrote:

I think this can be fixed by using image-mode-maybe in magic-mode-alist,
instead of image-mode.

I like this fix.

It is still possible to disguise an image type as another image type
(a JPEG with a .png file extension, for example), but I don't think
that's much of an issue, unless someone happens to trust jpeg62.dll
and not libpng13.dll, for example, which would be weird.

All in all, we should reach a decision regarding this issue and act
upon it. IIRC, there are a few alternatives:

1) Do nothing, i.e., let Emacs auto-detect images.
2) Disable auto-detection, but leave it available to users who want
to set it up (with `image-type-auto-detectable').
 3) Revert to previous state: Remove `image-type-auto-detected-p' and
`image-type-auto-detectable' and leave `magic-mode-alist' as before.
4) Use `image-type-maybe' (as per Jason's patch) so valid extensions
take precedence over contents-based detection (of image files, not in
the general case).
5) Ask the user when the file extension and the auto-detected image
type disagree.
6) Ask the user whenever an image file is auto-detected based on contents.
 7) Use a "disabled" wrapper for image-mode (or image-mode-maybe) in
`magic-mode-alist', so the user is forced to decide whether he trusts
auto-detection or not (I just dreamed this one, and I'm adding it out
of completeness, but I don't like it).
8) Any other?

My preferences are: 4, 2, 5, 6, 7, 1, 3.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]