On 24 February 2018 at 07:39, Kip Warner <[email protected]> wrote:
> 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.

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.

From a portability perspective, file(1) is probably the best option if
you find yourself stranded in the past, or on Unix-like systems like
macOS. I think it'd be kind of unreasonable to make file(1) depend on
the shared-mime database, considering the tool's history and the fact
that the people that tend to use exclusively file(1) are a fairly
conservative bunch. Nevertheless, you could ask the author to detect
if the shared-mime database is installed, and use that instead of the
magic numbers database:

  http://www.darwinsys.com/file/

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

> 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.

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

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
xdg mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to