[File] [PATCH] of Magdir/archive for misidentified Apple DiskCopy 4.2 image; correction

Jörg Jenderek joerg.jen.der.ek at gmx.net
Mon Apr 6 22:40:05 UTC 2020


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


at 07.04.2020 00:23 wrote Jörg Jenderek:
> Hello,
> some months ago i send patch for Magdir/archive for Apple DiskCopy
> 4.2 image. In the mean time sometimes other files are misidentified
> and i get an output like
> windows7en.mbr:       Apple DiskCopy 4.2 image
> 		      uÀZм, 3024206762 bytes,
> 		      0x55cd135d tag size, 0xf7 encoding, 0xc1 format
>
> Unfortunately Apple DiskCopy files have no real good 4 byte magic
> pattern. But according to mentioned DiskCopy 4.2 format
> specification on wiki.68kmla.org at offset 0x52 a 2 byte magic
> value 0x0100 is found. That is used as first test by line:
>  0x52	ubeshort	0x0100
>
> Two byte magic is not so strong. So i looked for more test lines.
> According to website lowest disk size is 400K. So test for such or
> bigger disk sizes by line
>  >0x40	ubelong		>409599	Apple DiskCopy 4.2 image
>
> Unfortunately these 2 tests are also true for master boot record of
> English Windows 7 (See example windows7en.mbr), but for that
> misidentified example an extreme high disc size of 3024206762 is
> shown. According to documentation for such floppy disc images
> highest size is 1440k. So now i also test for disk size equal or
> below 1440k by third additional line. This now becomes like
>  >0x40	ubelong		>409599
>  >>0x40	ubelong		<1474561	Apple DiskCopy 4.2 image
>
> Additional i also display a user defined mime magic by line like
>  !:mime	application/x-dc42-floppy-image
>
> After applying the above mentioned modifications by patch
> file-5.38-archive-dc42.diff then misidentification vanish
> and such old Apple disc images are still identified and described l
ik
> e:
>
> Disco 12.image:       Apple DiskCopy 4.2 image
>       		      Disco 12, 1474560 bytes,
> 		      MFM CAV dshd (1440k), 0x22 format
> Microsoft Mail.image: Apple DiskCopy 4.2 image
> 	  	      Microsoft Mail, 819200 bytes,
> 		      0x4b00 tag size,
> 		      GCR CLV dsdd (800k), 0x22 format
>
> I hope my diff file can be applied in future version of
> file utility.
>
> With best wishes
> Jörg Jenderek
>
>
Sorry i have appended a wrong older patch file-5.38-tplink-dbt.diff
Now comes the correct patch file-5.38-archive-dc42.diff !

Thanks
Jörg Jenderek
- --
Jörg Jenderek
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXouvxQAKCRCv8rHJQhrU
1m3xAJ9C9Jc9AjPLP6O4FTZpY4ArDrxaUgCfWC7tG7JPObHQmc/KEc3cDWKuyQQ=
=ebVu
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.38/magic/Magdir/archive.old	2019-11-15 21:03:14 +0000
+++ file-5.38/magic/Magdir/archive	2020-04-06 17:28:21 +0000
@@ -446,4 +446,7 @@
 # test for disk size equal or above 400k
->0x40	ubelong		>409599	Apple DiskCopy 4.2 image
+>0x40	ubelong		>409599
+# test for disk size equal or below 1440k
+>>0x40	ubelong		<1474561	Apple DiskCopy 4.2 image
 #!:mime	application/octet-stream
+!:mime	application/x-dc42-floppy-image
 !:apple	dCpydImg
@@ -451,20 +454,20 @@
 # image pascal name padded with NULs like Microsoft Mail
->>00	pstring/B	x	%s
+>>>00	pstring/B	x	%s
 # data size in bytes like 409600
->>0x40	ubelong		x	\b, %u bytes
+>>>0x40	ubelong		x	\b, %u bytes
 # tag size in bytes
->>0x44	ubelong		>0	\b, 0x%x tag size
+>>>0x44	ubelong		>0	\b, 0x%x tag size
 # data checksum
-#>>0x48	ubelong		x	\b, 0x%x checksum
+#>>>0x48	ubelong		x	\b, 0x%x checksum
 # tag checksum
-#>>0x4c	ubelong		x	\b, 0x%x tag checksum
+#>>>0x4c	ubelong		x	\b, 0x%x tag checksum
 # disk encoding
->>0x50	ubyte		0	\b, GCR CLV ssdd (400k)
->>0x50	ubyte		1	\b, GCR CLV dsdd (800k)
->>0x50	ubyte		2	\b, MFM CAV dsdd (720k)
->>0x50	ubyte		3	\b, MFM CAV dshd (1440k)
->>0x50	ubyte		>3	\b, 0x%x encoding
+>>>0x50	ubyte		0	\b, GCR CLV ssdd (400k)
+>>>0x50	ubyte		1	\b, GCR CLV dsdd (800k)
+>>>0x50	ubyte		2	\b, MFM CAV dsdd (720k)
+>>>0x50	ubyte		3	\b, MFM CAV dshd (1440k)
+>>>0x50	ubyte		>3	\b, 0x%x encoding
 # format byte
->>0x51	ubyte		x	\b, 0x%x format
-#>>0x54	ubequad		x	\b, data 0x%16.16llx
+>>>0x51	ubyte		x	\b, 0x%x format
+#>>>0x54	ubequad		x	\b, data 0x%16.16llx
 # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.38-archive-dc42.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20200407/c2a29a8e/attachment.obj>


More information about the File mailing list