118-magic-update-z-machine.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Author: Adam Buchbinder <adam.buchbinder@gmail.com>
  2. 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)
  3. diff -Naurp file.orig/magic/Magdir/adventure file/magic/Magdir/adventure
  4. --- file.orig/magic/Magdir/adventure 2009-03-21 09:20:03.000000000 +0000
  5. +++ file/magic/Magdir/adventure 2009-03-21 09:27:01.000000000 +0000
  6. @@ -17,17 +17,23 @@
  7. #------------------------------------------------------------------------------
  8. # Z-machine: file(1) magic for Z-machine binaries.
  9. #
  10. -# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which
  11. -# appears to be a version-0 Z-machine binary.
  12. +# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
  13. #
  14. -# The (false match) message is to correct that behavior. Perhaps it is
  15. -# not needed.
  16. +# The first byte is the Z-machine revision; it is always between 1 and 8. We
  17. +# had false matches (for instance, inbig5.ocp from the Omega TeX extension as
  18. +# well as an occasional MP3 file), so we sanity-check the version number.
  19. #
  20. -16 belong&0xfe00f0f0 0x3030 Infocom game data
  21. ->0 ubyte 0 (false match)
  22. ->0 ubyte >0 (Z-machine %d,
  23. ->>2 ubeshort x Release %d /
  24. ->>18 string >\0 Serial %.6s)
  25. +# It might be possible to sanity-check the release number as well, as it seems
  26. +# (at least in classic Infocom games) to always be a relatively small number,
  27. +# always under 150 or so, but as this isn't rigorous, we'll wait on that until
  28. +# it becomes clear that it's needed.
  29. +#
  30. +0 ubyte >0
  31. +>0 ubyte <9
  32. +>>16 belong&0xfe00f0f0 0x3030 Infocom game data
  33. +>>>0 ubyte x (Z-machine %d,
  34. +>>>>2 ubeshort x Release %d /
  35. +>>>>18 string >\0 Serial %.6s)
  36. #------------------------------------------------------------------------------
  37. # Glulx: file(1) magic for Glulx binaries.