Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stokito opened this issue Dec 24, 2019 · 1 comment
Open

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

stokito opened this issue Dec 24, 2019 · 1 comment

Comments

@stokito
Copy link

stokito commented Dec 24, 2019

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
@janhoy
Copy link

janhoy commented Nov 8, 2023

I found the same when trying to use latest version of "archive" and "cafebabe" magic files.
The parser barfs at types name and use, which are perhaps added to the file format standard at a later time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants