file(1) / magic(5) database vs shared-mime-info database

Kip Warner kip at thevertigo.com
Sun Feb 25 21:51:17 UTC 2018


On Sat, 2018-02-24 at 12:10 +0000, Emmanuele Bassi wrote:
> The file(1) commands predates not just Linux by about 20 years, but
> the whole of freedesktp.org, including the shared-mime database, by
> about 30 years.

That's what I thought. On my Debian based distro it appears to ship a
BSD variant.

> Ideally, though, you should ignore file(1) and magic(5) altogether on
> Linux, if you are dealing with MIME types.

Out of curiosity though, what about in the web world where php(1) or
some other ensemble of tools used to serve browser scripts need to
check MIME types? At this time I think they probably all rely on
file(1) and its API?

> Considering that every single xdg-util utility is a shell script that
> calls existing binaries, you can very likely write an
> "xdg-content-type" that calls things like `gio info -a
> standard::content-type` on a file under GNOME, or any other utility
> under other environments, and propose it for inclusion in the xdg-
> util
> suite:
> 
>   https://cgit.freedesktop.org/xdg/xdg-utils

Yes, that could work. For people who have traditional file(1) installed
already, they could have them both on their system and select which one
to use via update-alternatives or some such.

-- 
Kip Warner | Senior Software Engineer
OpenPGP signed/encrypted mail preferred
https://www.cartesiantheatre.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20180225/1a8fcf76/attachment.sig>


More information about the xdg mailing list