Author: Adam Buchbinder Description: Fixing false matches against Z-machine pattern. A particular MP3 file as well as a particular file from texlive-omega match the pattern for Z-machine games. Make the pattern a bit more restrictive to get rid of the false matches. (Closes: #499748) diff -Naurp file.orig/magic/Magdir/adventure file/magic/Magdir/adventure --- file.orig/magic/Magdir/adventure 2009-03-21 09:20:03.000000000 +0000 +++ file/magic/Magdir/adventure 2009-03-21 09:27:01.000000000 +0000 @@ -17,17 +17,23 @@ #------------------------------------------------------------------------------ # Z-machine: file(1) magic for Z-machine binaries. # -# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which -# appears to be a version-0 Z-machine binary. +# Updated by Adam Buchbinder # -# The (false match) message is to correct that behavior. Perhaps it is -# not needed. +# The first byte is the Z-machine revision; it is always between 1 and 8. We +# had false matches (for instance, inbig5.ocp from the Omega TeX extension as +# well as an occasional MP3 file), so we sanity-check the version number. # -16 belong&0xfe00f0f0 0x3030 Infocom game data ->0 ubyte 0 (false match) ->0 ubyte >0 (Z-machine %d, ->>2 ubeshort x Release %d / ->>18 string >\0 Serial %.6s) +# It might be possible to sanity-check the release number as well, as it seems +# (at least in classic Infocom games) to always be a relatively small number, +# always under 150 or so, but as this isn't rigorous, we'll wait on that until +# it becomes clear that it's needed. +# +0 ubyte >0 +>0 ubyte <9 +>>16 belong&0xfe00f0f0 0x3030 Infocom game data +>>>0 ubyte x (Z-machine %d, +>>>>2 ubeshort x Release %d / +>>>>18 string >\0 Serial %.6s) #------------------------------------------------------------------------------ # Glulx: file(1) magic for Glulx binaries.