[Top][All Lists]

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

Re: [bug #64253] Suggestion - Add support for libmagic and xattr

From: raf
Subject: Re: [bug #64253] Suggestion - Add support for libmagic and xattr
Date: Thu, 1 Jun 2023 09:04:28 +1000

On Wed, May 31, 2023 at 11:19:27PM +0200, Bernhard Voelker 
<mail@bernhard-voelker.de> wrote:

> On 5/27/23 01:39, raf wrote:
> > I could be wrong, but I don't think a -mime predicate adds much value. Since
> > mimetypes are determined by file name extension anyway, [...]
> I don't think (proper) tools determine the mime type of a file by its 
> extension.
> Instead, they (should) always look at the content of the file.
> Therefore, if we add -magic, then also adding -mime makes sense, because the
> latter yields output which seems to be standardized.
> Have a nice day,
> Berny

If you say so. But my understanding is that mime types
are determined by looking up file name extensions in
the /etc/mime.types file, and using the corresponding
mime type. At least, that's very much how it looks on
Debian. That file must exist for a reason. But it does
look like libmagic can return mime types too, according
to libmagic(3). That's good.

But on my Debian vm, running strings on libmagic.a
and libmagic.so shows /etc/magic:/usr/share/misc/magic
which looks like the place to store mime type strings,
but both locations are empty. /usr/share/misc/magic is
a symlink to /usr/share/file/magic which is empty. I
wonder how it works.

According to magic(5), it looks like users can specify
mime information along with new magic data. Presumably,
the main magic database must have the mime information
inside it, and those other paths are just for
site-local additions.

Mind you, I'm having trouble finding the "main" magic
database. It must be around here somewhere...
Maybe it is magic. :-)


reply via email to

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