#36 Mime-util fails to parse magic.mime file containing "&" character in 1st column

v1.0_(example)
open
nobody
None
5
2014-08-19
2013-06-28
Dominik Pospisil
No

Mime-util fails to parse /usr/share/file/magic.mime on RHEL5.9 platform. It fails on the following line:

&1 string webm video/webm

Seems that mime-util is unable to parse "&" character in offset collumn. See man magic for the magic file format reference.

Discussion

  • WARN [eu.medsea.mimeutil.detector.MagicMimeMimeDetector] (MSC service thread 1-2) eu.medsea.mimeutil.detector.InvalidMagicMimeEntryException: Invalid Magic Mime Entry: [>>&1 string webm video/webm]: file "/usr/share/file/magic.mime": before or at line 22: eu.medsea.mimeutil.detector.InvalidMagicMimeEntryException: Invalid Magic Mime Entry: [>>&1 string webm video/webm]
    at eu.medsea.mimeutil.detector.MagicMimeEntry.<init>(MagicMimeEntry.java:84) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeEntry.<init>(MagicMimeEntry.java:91) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeEntry.<init>(MagicMimeEntry.java:91) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeEntry.<init>(MagicMimeEntry.java:67) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeMimeDetector.addEntry(MagicMimeMimeDetector.java:531) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeMimeDetector.parse(MagicMimeMimeDetector.java:511) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeMimeDetector.parseMagicMimeFileLocation(MagicMimeMimeDetector.java:413) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeMimeDetector.initMagicRules(MagicMimeMimeDetector.java:378) [mime-util-2.1.3.jar:]
    at eu.medsea.mimeutil.detector.MagicMimeMimeDetector.<init>(MagicMimeMimeDetector.java:157) [mime-util-2.1.3.jar:]