mime.types vs mime/globs (was Re: Shall we serve scripts as application or as text?)
Le Sun, Aug 29, 2021 at 10:53:04PM +0000, Thaddeus H. Black a écrit :
>
> What is the relationship between /etc/mime.types
> and /usr/share/mime/globs, please? When to use the one and when,
> the other?
Hi Thaddeus,
/etc/mime.types is a conffile; you can edit it and dpkg will ensure to
preserve the changes or prompt you in case of conflicts during upgrades.
/usr/share/mime/globs is an autogenerated file. Any change you make
there can be silently lost.
Also, /etc/mime.types is provided by a package, media-types, that
contains only this file, does not have dependancies and is more likely
to be installed on desktopless systems.
So if you only need a one-to-one lookup table for associating media
types and file extensions, and if you need to allow easy extension and
customisation by the local administrator, you should better use
/etc/mime.types.
The information in both files overlap a lot since most of it has the same
origin: the media types registered at the IANA.
https://www.iana.org/assignments/media-types/media-types.xhtml
This said, the XDG's shared MIME-info database contains much more
information than /etc/mime.types, such as magic numbers or subtypes.
If you write an application for a system where you can be sure that
this information is available, use it !
Cheers,
Charles
--
Charles Plessy Nagahama, Yomitan, Okinawa, Japan
Tooting from work, https://mastodon.technology/@charles_plessy
Tooting from home, https://framapiaf.org/@charles_plessy
Reply to: