On Wed, May 31, 2023 at 11:19:27PM +0200, Bernhard Voelker 
<m...@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. :-)

cheers,
raf


Reply via email to