[File] [PATCH] Magdir/dyadic Dyalog APL misidentifies policyccnvchangeauth-auth.bin

Jörg Jenderek joerg.jen.der.ek at gmx.net
Sun Apr 3 23:41:30 UTC 2022


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

Hello,

some days ago i handled files with bin name extensions. In emulator
QEMU package was a file named policyccnvchangeauth-auth.bin.


When running file command version 5.41 on this example and related
files i get an output like:

GolfData.DCF:                  Dyalog APL
			       component file 32-bit
			       non-journaled non-checksummed
			       version 10.1
PlanBookFinal.dws:             Dyalog APL
			       workspace 32-bit
			       classic little-endian
			       version 11.13
def_us.dse:                    Dyalog APL
			       session version 13.4
dwsout_nfiles.dws:             Dyalog APL
			       workspace 32-bit
			       classic little-endian
			       version 10.4
fruit.dws:                     Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 13.4
policyccnvchangeauth-auth.bin: Dyalog APL
			       version -91.-104
session_log.dlf:               Dyalog APL
			       session
			       version 2.0
tetris.dws:                    Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 13.3
webcache.DCF:                  Dyalog APL
			       component file 32-bit
			       non-journaled non-checksummed
			       version 9.0
xfrcode.dws:                   Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 12.5


Furthermore with -i option only generic application/octet-stream is
shown. With option --extension only 3 byte sequence ??? is shown.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). The examples with
DWS are described as "Dyalog APL WorkSpace" by dws-dyalog.trid.xml
and the samples with DCF are described as "Dyalog APL Component
File" by dcf-dyalog.trid.xml. Furthermore the "bad" example
policyccnvchangeauth-auth.bin is not misidentified (See appended
dyalog_trid-v.txt). This list with -v option the related URL
pointing to used file information and also the used file name
extension.

With this information i was able to find also a page about APL
workspace file formats archive team website. That information is
now expressed by comment line inside Magdir/dyadic like:
# URL:	http://fileformats.archiveteam.org/wiki/APL_workspace

In Magdir/dyadic the major and minor version are shown by line like:
>>> 2	byte		x		version %d 3	byte		x		\b.%d

For real Dyalog samples i get low positive numbers for major
version like:
2 7 9 10 11 12 13
For real Dyalog samples i get zero or low positive numbers for
minor version like:
0 1 2 3 4 5 9 12 13
But i never get negative numbers or very high numbers for real
examples.

In current version as third test it was only checked if version
numbers are not zero by line like:

>> 2	ubeshort	>0x0000		Dyalog APL

Apparently this condition is not sufficient. So now i explicitly
check for "low" positive major version number. This now becomes like:
>> 2	byte		>0
If more misidentified examples occur than maybe test also for valid
low minor version number by additional fourth test line like:
>>> 3	byte		>0

After applying the above mentioned modifications by patch
file-5.41-dyadic.diff the samples are now described with additional
file name extension and misidentification of
policyccnvchangeauth-auth.bin vanished and this now looks like:

GolfData.DCF:                  Dyalog APL
			       component file 32-bit
			       non-journaled non-checksummed
			       version 10.1
PlanBookFinal.dws:             Dyalog APL
			       workspace 32-bit
			       classic little-endian
			       version 11.13
def_us.dse:                    Dyalog APL
			       session
			       version 13.4
dwsout_nfiles.dws:             Dyalog APL
			       workspace 32-bit
			       classic little-endian
			       version 10.4
fruit.dws:                     Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 13.4
policyccnvchangeauth-auth.bin: data
session_log.dlf:               Dyalog APL
			       session version 2.0
tetris.dws:                    Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 13.3
webcache.DCF:                  Dyalog APL
			       component file 32-bit
			       non-journaled non-checksummed
			       version 9.0
xfrcode.dws:                   Dyalog APL
			       workspace 32-bit
			       unicode little-endian
			       version 12.5


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+v8rHJQhrU1gUCYkowqgAKCRCv8rHJQhrU
1udVAKCdNLQ3LhFDWTssx+H6/CLU7M3Q4gCff2NNGCES/YpXENypZyDpeFBENnQ=
=k5+a
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.41/magic/Magdir/dyadic.old	2020-05-31 12:34:40.000000000 +0200
+++ file-5.41/magic/Magdir/dyadic	2022-04-04 01:22:42.214822000 +0200
@@ -4,7 +4,8 @@
 # Dyadic: file(1) magic for Dyalog APL.
 #
-# updated by Joerg Jenderek at Oct 2013
+# updated by Joerg Jenderek at Oct 2013, Mar 2022
 # https://en.wikipedia.org/wiki/Dyalog_APL
 # https://www.dyalog.com/
+# URL:	http://fileformats.archiveteam.org/wiki/APL_workspace
 # .DXV Dyalog APL External Variable
 # .DIN Dyalog APL Input Table
@@ -12,12 +13,18 @@
 # .DFT Dyalog APL Format File
 0	ubeshort&0xFF60	0xaa00
-# skip biblio.dbt
+# skip dbase biblio.dbt
 >1	byte		!4
-# real Dyalog APL have non zero version numbers like 7.3 or 13.4
->>2	ubeshort	>0x0000		Dyalog APL
+# real Dyalog APL have low positive version numbers like 7.3 or 13.4
+# So skip also policyccnvchangeauth-auth.bin from qemu emulator package
+>>2	byte		>0		Dyalog APL
+# maybe test also for valid low minor version number
+#>>>3	byte		>0		Dyalog APL
 >>>1	byte		0x00		aplcore
 #>>>1	byte		0x00		incomplete workspace
 # *.DCF Dyalog APL Component File
 >>>1	byte		0x01		component file 32-bit non-journaled non-checksummed
+#!:mime	application/octet-stream
+!:mime	application/x-dyalog-dcf
+!:ext	dcf
 #>>>1	byte		0x01		component file
 >>>1	byte		0x02		external variable exclusive
@@ -25,4 +32,7 @@
 # *.DWS Dyalog APL Workspace
 >>>1	byte		0x03		workspace
+#!:mime	application/octet-stream
+!:mime	application/x-dyalog-dws
+!:ext	dws
 >>>>7	byte&0x28	0x00		32-bit
 >>>>7	byte&0x28	0x20		64-bit
@@ -34,4 +44,7 @@
 # *.DSE Dyalog APL Session , *.DLF Dyalog APL Session Log File
 >>>1	byte		0x07		session
+#!:mime	application/octet-stream
+!:mime	application/x-dyalog-session
+!:ext	dse/dlf
 >>>1	byte		0x08		mapped file 32-bit
 >>>1	byte		0x09		component file 64-bit non-journaled non-checksummed
@@ -53,5 +66,7 @@
 >>>1	byte		0x19		external workspace
 >>>1	byte		0x80		DDB
+# major version number like: 2 7 9 10 11 12 13
 >>>2	byte		x		version %d
+# minor version number like: 0 1 2 3 4 5 9 12 13
 >>>3	byte		x		\b.%d
 #>>>2	byte		x		type %d
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.41-dyadic.diff.sig
Type: application/octet-stream
Size: 1055 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20220404/ea4d88f3/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dyalog_trid-v.txt.gz
Type: application/x-gzip
Size: 529 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20220404/ea4d88f3/attachment.bin>


More information about the File mailing list