Skip to content

Upgrade built-in magic file and use external on Linux #68

@stokito

Description

@stokito

From what I see the magic.gz file which is included into the simplemagic.jar is outdated.
It was originally copied from CentOS and looks like you are updating it manually instead of copy it from the fresh /etc/magic.
Even more, the /etc/magic file is not present anymore on the current Linux distributions.
The MIME db file is part of the file utility which migrated to libmagic and changed the directories layout.
First of all the MIME types DB is located in the file's directory magic/Magdir. Then it's compiled to /usr/share/file/magic.mgc file.
Maybe MacOS or some FreeBSD still have the /etc/magic file but I don't think so.

So, here is few things:

  1. It doesn't make any sense to mention the non existing /etc/magic file anymore or we have to mention that it may be absent.
  2. It would be great to parse the compiled magic.mgc file instead and replace the internal magic.gz with the magic.mgc.
  3. Even if we can't parse the compiled magic.mgc then at least we can update magic db from the actual magic/Magdir which is constantly updated.
  4. I tried to use archive and compress files from the magic/Magdir but some entries are failed to parse. This means that their format is more advanced and the simplemagic should be adjusted.
  5. The magic.mgc file is more than 5mb which is quite a lot it is worth to consider Slim version without internal config files  #63

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions