Package: file
Version: 4.12-1
Severity: minor

Hi -

There are two separate sets of magic rules for doom WAD
files, each of which is flawed. Please find attached an
improvement. Here is an explanation of why it's better:

Doom WAD files come in two varieties: IWADs and PWADs.  They
are identified by the ASCII string PWAD or IWAD at the
beginning of the file. Thomas M. Ott tries to express this
using the first three rules:

 1      string  =WAD            DOOM data,
 >0     string  =I              main wad
 >0     string  =P              patch wad
 >0     byte    x               unknown junk

...but e.g. 'CWAD' is not valid DOOM data.  The fourth rule
appears to be an attempt to identify this, but in fact will
always be triggered, meaning all matches have 'unknown junk'
in the output.

Nicolas Patrois correctly distinguishes IWADs and PWADs, but
does not include the keyword 'data' in the output, nor
'WAD'. 

 0       string  IWAD    DOOM or DOOM ][ world
 0       string  PWAD    DOOM or DOOM ][ extension world

Also, 'DOOM or DOOM ][' is a simplification: it could be a
WAD for doom, doom2, ultimate doom, final doom, heretic,
hexen, strife... etc. 'doom' is a good generalisation.

The solution I supply also tells you how many lumps are in
the WAD file by decoding the lelong that follows the magic.
I've tested this on 32 bit and 64 bit machines on SF.net's
compile farm.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.13.4-jmtd2
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages file depends on:
ii  libc6                  2.3.2.ds1-22      GNU C Library: Shared libraries an
ii  libmagic1              4.12-1            File type determination library us
ii  zlib1g                 1:1.2.2-4.sarge.2 compression library - runtime

-- no debconf information

-- 
Jon Dowland
http://alcopop.org/
--- file-4.17/magic/Magdir/games~       2004-05-12 15:41:37.000000000 +0100
+++ file-4.17/magic/Magdir/games        2006-03-27 19:44:19.000000000 +0100
@@ -1,12 +1,6 @@
 #------------------------------------------------------------------------------
 # games:  file(1) for games
 
-# Thomas M. Ott (ThMO)
-1      string  =WAD            DOOM data,
->0     string  =I              main wad
->0     string  =P              patch wad
->0     byte    x               unknown junk
-
 # Fabio Bonelli <[EMAIL PROTECTED]>
 # Quake II - III data files
 0       string  IDP2           Quake II 3D Model file,
@@ -29,11 +23,6 @@
 # Doom and Quake
 # submitted by Nicolas Patrois
 
-# DOOM
-
-0       string  IWAD    DOOM or DOOM ][ world
-0       string  PWAD    DOOM or DOOM ][ extension world
-
 0       string  \xcb\x1dBoom\xe6\xff\x03\x01    Boom or linuxdoom demo
 # some doom lmp files don't match, I've got one beginning with \x6d\x02\x01\x01
 
@@ -155,3 +144,10 @@
 
 0      string  MComprHD        MAME CHD compressed hard disk image,
 >12    belong  x               version %lu
+
+# doom - submitted by Jon Dowland
+
+0      string  =IWAD           doom main IWAD data
+>4     lelong  x               containing %d lumps
+0      string  =PWAD           doom patch PWAD data
+>4     lelong  x               containing %d lumps

Attachment: signature.asc
Description: Digital signature

Reply via email to