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

Kip Warner <[email protected]>
Newsgroups gmane.linux.xdg.devel
Message-ID <[email protected]>
Hey list,

Unless I'm misunderstanding things, it seems to me as though typical
GNU typical distros seem to ship two different systems for determining
a file's magic. 

There is the older file(1) / libmagic / magic(5) mechanism. One can
test it via running file(1) on a particular file and it will identify
it and can also provide the MIME type.

The second way is via /usr/share/mime/packages/<mypackage>.xml
mechanism as described by the fd.o shared-mime-info-spec. Typical
desktop shells like Gnome's Nautilus, Xfce's Thunar, pcmanfm, etc.,
seem to identify files via this way.

The amount of redundant work in specifying file magic patterns for both
systems is substantial considering how many different types of files
there are out there in the wild. I am assuming, but I don't know this
for certain, but the latter's
/usr/share/mime/packages/freedesktop.org.xml might have been initially
generated from file(1)'s upstream magic source database (ships as
libmagic-mgc on my distro).

Ironically neither one of these two mechanisms seem to communicate with
each other. If the second mechanism is intended to superannuate the
first, would it not make sense to provide an fd.o replacement for
file(1) which queries the system's shared-mime-info database instead? I
would think this should be trivial to implement.

Yours truly,

-- 
Kip Warner | Senior Software Engineer
OpenPGP signed/encrypted mail preferred
https://www.cartesiantheatre.com

_______________________________________________
xdg mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xdg
signature.asc (application/pgp-signature, 163 B)
-----BEGIN PGP SIGNATURE-----

iEYEABECAAYFAlqRFpoACgkQLXnfK7bii20jVgCgpXfUNWhuLM8CIW63qLynCtK8
1woAnRorbD8qzuUqeuOrgrAbYLLTXsuC
=GKUw
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.