[File] [PATCH] Magdir/magic text file misitetifies Magicsee R1 controller Magicsee_R1.cfg
Jörg Jenderek (GMX)
joerg.jen.der.ek at gmx.net
Sat Jun 24 12:27:38 UTC 2023
Hello,
some times ago i send patch of Magdir/mathematica to recognize
Matlab files, which normally have file name suffix mat. Some times ago
i must look for file with suffix bin. Some are misidentified as
Matlab v4 mat-file (little endian). I found such samples in directory
/usr/lib/firmware/radeon on Linux Mint 21.1.
When running file command version 5.44 on such
real Matlab examples and
some misidentified samples i get an output like:
Header: magic text file for file(1) cmd, ASCII text
Magicsee_R1.cfg: ASCII text
magic.mgc: magic binary file for file(1) cmd (version 18) (little
endian)
For comparison reason i run other utilities. The file identifier
tool TrID (see http://mark0.net/soft-trid-e.html) does not recognize
the files. All are described wrong as "Adobe PhotoShop Brush" by
abr.trid.xml (See appended trid-v-mat.txt.gz).
DROID (Digital Record and Object Identification) is a software tool
developed by The National Archives of UK to perform automated batch
identification of file formats. See
https://digital-preservation.github.io/droid/
According to that tool the real samples are described as "MATLAB Mat
File " with version "Level 4" by PUID fmt/1550 via extension.
(See appended droid-mat.csv.gz)
First we see that we see that we get very high values for rows and
columns. That is very unlikely but not forbidden. For real MAT samples
after (little endian) phrase a matrix name is shown like:
fit_params testmatrix testsparsecomplex teststringarray
For misidentified samples i get here nothing.
This output is done by subroutine matlab4 inside Magdir/mathematica.
The relevant lines look like:
#>16 ubelong x \b, name length %u
#>20 string x \b, MATRIX NAME="%s"
>16 pstring/L x %s
For the firmware samples no pascal string is displayed for
misidentified MATRIX NAME "\231" because name length is zero. Assuming
that real MAT samples always have an embedded matrix name the radeon
firmware samples can be skipped before calling subroutine by just
checking for positive matrix name length. So the test lines before sub
routine call now becomes like:
>>>>>>16 ulelong <3
>>>>>>>16 ubelong >0
>>>>>>>>0 use \^matlab4
After applying the above mentioned modifications by patch
file-5.44-mathematica-mat.diff then i get an output like:
BONAIRE_sdma.bin: data
HAWAII_sdma.bin: data
KABINI_sdma.bin: data
KAVERI_sdma.bin: data
MULLINS_sdma.bin: data
testvec_4_GLNX86.mat: Matlab v4 mat-file (little endian) fit_params
, numeric, rows 2, columns 1
I hope my diff file can be applied in future version of
file utility.
With best wishes
Jörg Jenderek
--
Jörg Jenderek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: droid-mat.csv.gz
Type: application/x-gzip
Size: 389 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230624/ba5ab942/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-mat.txt.gz
Type: application/x-gzip
Size: 334 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230624/ba5ab942/attachment-0001.bin>
-------------- next part --------------
--- file-5.44/magic/Magdir/mathematica.old 2022-11-30 00:04:06.000000000 +0100
+++ file-5.44/magic/Magdir/mathematica 2023-06-15 23:06:54.484641200 +0200
@@ -134,12 +134,16 @@
>>>>>12 ulelong <2
# no misidentified little endian MATrix example with "short" matrix name
>>>>>>16 ulelong <3
->>>>>>>0 use \^matlab4
+# skip radeon firmware BONAIRE_sdma.bin HAWAII_sdma.bin KABINI_sdma.bin KAVERI_sdma.bin MULLINS_sdma.bin
+# by check for non zero matrix name length
+>>>>>>>16 ubelong >0
+>>>>>>>>0 use \^matlab4
# little endian MATrix with "long" matrix name or some misidentified samples
>>>>>>16 ulelong >2
# skip TileCacheLogo-*.dat with invalid 2nd character \001 of matrix name with length 96
>>>>>>>21 ubyte >0x1F
>>>>>>>>0 use \^matlab4
+# Note: called "MATLAB Mat File" with version "Level 4" by DROID via PUID fmt/1550
# display information of Matlab v4 mat-file
0 name matlab4 Matlab v4 mat-file
#!:mime application/octet-stream
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.44-mathematica-mat.diff.sig
Type: application/octet-stream
Size: 703 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230624/ba5ab942/attachment.obj>
-------------- next part --------------
--
File mailing list
File at astron.com
https://mailman.astron.com/mailman/listinfo/file
More information about the File
mailing list