[File] [PATCH] Magdir/database misidentifies LX*.OUT as FoxPro FPT with invalid block size

Jörg Jenderek joerg.jen.der.ek at gmx.net
Mon Feb 21 13:44:49 UTC 2022


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

Hello,

some days ago i handled some samples with file name extension OUT.

When running file command version 5.41 on such examples and related
real FPT examples i get an output like:

LXMDALG4.OUT:  FoxPro FPT, blocks size 170,
	       next free block index 455770112, field type 0
LXMDCLN4.OUT:  FoxPro FPT, blocks size 170,
	       next free block index 455770112, field type 0
LXMDCLN6.OUT:  FoxPro FPT, blocks size 170,
	       next free block index 455770112, field type 0
NG.FPT:        FoxPro FPT, blocks size 256,
	       next free block index 432, field type 1,
	       field length 48, 1st item
	       "386 registers 1993 - Pavel Machek (PMK software)"
test-pic.FPT:  FoxPro FPT, blocks size 64,
	       next free block index 34, field type 0
vFoxpro-8.FPT: FoxPro FPT, blocks size 64,
	       next free block index 2410, field type 2
vFoxpro.FPT:   FoxPro FPT, blocks size 64,
	       next free block index 15, field type 1,
	       field length 8, 1st item
	       "1st memo"

The OUT examples are found beneath sub directory FileRepository on
a Vista Windows system. So i knew that identification as FPT is wrong
.

Unfortunately the FoxPro FPT have no characteristic magic pattern,
but luckily the displaying part is done by sub routine
foxpro-memo-print inside Magdir/database. After file name extension
line the block size is shown by line like:
 >6		ubeshort	x		\b, blocks size %u
For real FPT examples i get here values like 64 or 256. Obviously
for performance reasons a higher multiple of two is used. For the
misidentified OUT examples i get here value 170 (=0xAA). That is
apparently nonsense. So i add one additional test for that
condition before calling the sub routine. So this now becomes like:

 >>>>>>>>>>>>6	ubeshort&0x002f	0
 >>>>>>>>>>>>>0	use		foxpro-memo-print

After applying the above mentioned modifications by patch
file-5.41-database-fpt.diff then all FPT inspected examples are now
described as before, but the misidentification vanish. This now
looks like:
LXMDALG4.OUT:  data
LXMDCLN4.OUT:  data
LXMDCLN6.OUT:  data
NG.FPT:        FoxPro FPT, blocks size 256,
	       next free block index 432, field type 1,
	       field length 48, 1st item
	       "386 registers 1993 - Pavel Machek (PMK software)"
test-pic.FPT:  FoxPro FPT, blocks size 64,
	       next free block index 34, field type 0
vFoxpro-8.FPT: FoxPro FPT, blocks size 64,
	       next free block index 2410, field type 2
vFoxpro.FPT:   FoxPro FPT, blocks size 64,
	       next free block index 15, field type 1,
	       field length 8, 1st item
	       "1st memo"

I hope my diff file can be applied in future version of file
utility.

With best wishes
Jörg Jenderek
- --
Jörg Jenderek

-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCYhOXUAAKCRCv8rHJQhrU
1tPmAJ4/AEaIvZ2BdsP2RRueGTlYnH5sPgCgluFJJ1V0FhJOYrAWUeF01MobdRE=
=Bise
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.41/magic/Magdir/database.old	2021-10-18 16:20:03.000000000 +0200
+++ file-5.41/magic/Magdir/database	2022-02-21 02:53:53.725855700 +0100
@@ -398,9 +398,11 @@
 # skip emacs.PIF
 >>>>>>>>>>4	ushort		0
 # check for valid FoxPro field type
 >>>>>>>>>>>512	ubelong		<3
->>>>>>>>>>>>0	use		foxpro-memo-print
+# skip LXMDCLN4.OUT LXMDCLN6.OUT LXMDALG6.OUT with invalid blocksize 170=AAh
+>>>>>>>>>>>>6	ubeshort&0x002f	0
+>>>>>>>>>>>>>0	use		foxpro-memo-print
 # dBASE III DBT , garbage
 # skip WORD1XW.DOC with improbably high free block index
 >>>>>>>>>0	ulelong		<0x400000
 # skip WinStore.App.exe by looking for printable 2nd character of 1st memo item
@@ -485,9 +487,9 @@
 0	name				foxpro-memo-print
 >0		belong		x		FoxPro FPT
 !:mime	application/x-fpt
 !:ext	fpt
-# Size of blocks for FoxPro ( 64,256 )
+# Size of blocks for FoxPro ( 64,256 ); probably a multiple of two
 >6		ubeshort	x		\b, blocks size %u
 # next available block
 #>0		belong		=0		\b, next free block index %u
 >0		belong		!0		\b, next free block index %u
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.41-database-fpt.diff.sig
Type: application/octet-stream
Size: 716 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20220221/732bcfa4/attachment.obj>


More information about the File mailing list