Apparently level 0 matches are different from level >0 matches to file. Forcing it to level 1 allows if-then-else structures like the following I used for testing:

0       string          \<?xml
>0   string          \<?xml
>>38      string          \<\!DOCTYPE\040svg   image/svg+xml
>>38      string          \<\!DOCTYPE\040sve   image/sve+xml
>0   string          \<?xml                       text/xml

The following patch against file-4.12-1 magic.mime fixes the problem:

--- file-4.12/magic/magic.mime  2006-01-21 15:56:54.000000000 +0200
+++ magic.mime  2006-01-21 16:35:20.000000000 +0200
@@ -95,17 +95,12 @@
 # end local stuff

#------------------------------------------------------------------------------

-# xml based formats!
-
-# svg
+# xml-based formats!

 0      string          \<?xml
-#                      text/xml
->38    string          \<\!DOCTYPE\040svg      image/svg+xml
-
-
-# xml
-0      string          \<?xml                  text/xml
+>0     string          \<?xml
+>>38   string          \<\!DOCTYPE\040svg      image/svg+xml
+>0     string          \<?xml                  text/xml



#------------------------------------------------------------------------------
@@ -400,7 +395,6 @@
 0      string          \<!--   text/html
 0      string/c        \<h1    text/html

-0      string          \<?xml                  text/xml


#------------------------------------------------------------------------------
# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to