[File] [PATCH] Magdir/iff IFF data, PTCH binary patch; missing extensions
Jörg Jenderek (GMX)
joerg.jen.der.ek at gmx.net
Wed Feb 7 22:40:01 UTC 2024
Hello,
some days ago i must handle some patch files. Sometimes the file name
suffix PCH is used. For control reason i look for samples with that
suffix on my systems. In context of "Amiga" operating system i found
such samples.
When i run file command version 5.45 on such samples i get a output like:
ToolsDaemon-handler.pch: IFF data, PTCH binary patch
ToolsDaemon.pch: IFF data, PTCH binary patch
ToolsPrefs.pch: IFF data, PTCH binary patch
Furthermore only generic mime type application/octet-stream is
shown with -i option. With option --extension only 3 byte
sequence ??? is shown.
For comparison reason i also run the file format identification utility
DROID (See https://sourceforge.net/projects/droid/). Here the samples
are recognized generic and described as "Interchange File" by PUID
x-fmt/157. Here PCH suffix is considered as "bad".
On Linux according to shared MIME-info database such samples are called
"IFF file" or as alias expanded "Interchange File Format". Here
application/x-iff is used as mime type. The samples are just recognized
by looking for 4 byte sequence FORM at the beginning. Here no suffix are
listed. That information can be seen in source freedesktop.org.xml.in
found for example on gitlab.freedesktop.org.
For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). The samples are
recognized and described as "IFF binary Patch" with mime type
application/octet-stream and 2 suffix (.PCH/PATCH) by iff-pch.trid.xml.
The samples are also described with low priority as "Generic IFF
container" with mime type application/x-iff by iff-gen.trid.xml, because
of 4 byte string FORM at the beginning. Here page about "Interchange
File Format" on Wikipedia is used as reference (See appended
trid-v-pch.txt.gz).
This tool list the used file name extension and with -v option the
related URL pointing to used file format information. That
informations are expressed by comment lines inside Magdir/iff like:
# URL: https://en.wikipedia.org/wiki/Interchange_File_Format
# Ref.: https://wiki.amigaos.net/wiki/IFF_FORM_and_Chunk_Registry
# Ref.: http://mark0.net/download/triddefs_xml.7z/
# defs/i/iff-pch.trid.xml
All samples are at least general described by Magdir/iff with line
0 string FORM IFF data
The next sub classification step is done by looking for string at offset
4. So for my inspected patch samples this is done by line like
>8 string PTCH \b, PTCH binary patch
Because such files are binary so generic application/octet-stream mime
type is not wrong. Because of magic FORM at the beginning container
format is IFF data that would be matched by application/x-iff. But i
choose an user defined one that is related to other patch formats (most
are text files with mime type like text/x-patch). So this and file name
suffix are shown by additional new lines like:
!:mime application/x-amiga-patch
!:ext patch/pch
After applying the above mentioned modifications by patch
file-iff-pch.diff then all my inspected Amiga patches are now described
with more details (file name suffix, mime type). This with --extension
option now looks like:
ToolsDaemon-handler.pch: patch/pch
ToolsDaemon.pch: patch/pch
ToolsPrefs.pch: patch/pch
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 --------------
--- file-master/magic/Magdir/iff.old 2024-02-04 21:06:29.096499200 +0100
+++ file-master/magic/Magdir/iff 2024-02-04 21:43:12.945824600 +0100
@@ -11,6 +11,10 @@
# FORM type, which is followed by the first chunk in the FORM.
# URL: http://fileformats.archiveteam.org/wiki/IFF
+# https://en.wikipedia.org/wiki/Interchange_File_Format
+# Reference: https://wiki.amigaos.net/wiki/IFF_FORM_and_Chunk_Registry
+# Note: called "Interchange File" by DROID via PUID x-fmt/157 and
+# "IFF file" or as alias expanded "Interchange File Format" by shared MIME-info database from freedesktop.org
0 string FORM IFF data
#>4 belong x \b, FORM is %d bytes long
# audio formats
@@ -61,7 +65,14 @@
>8 string CTLG \b, CTLG message catalog
>8 string PREF \b, PREF preferences
>8 string DTYP \b, DTYP datatype description
+# Update: Joerg Jenderek
+# Reference: http://mark0.net/download/triddefs_xml.7z/defs/i/iff-pch.trid.xml
+# Note: called "IFF binary Patch" by TrID
>8 string PTCH \b, PTCH binary patch
+#!:mime application/octet-stream
+#!:mime application/x-iff
+#!:mime application/x-amiga-patch
+!:ext patch/pch
>8 string AMFF \b, AMFF AmigaMetaFile format
>8 string WZRD \b, WZRD StormWIZARD resource
>8 string DOC\040 \b, DOC desktop publishing document
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-iff-pch.diff.sig
Type: application/octet-stream
Size: 881 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20240207/15573e86/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-iff-pch.txt.gz
Type: application/x-gzip
Size: 465 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20240207/15573e86/attachment.bin>
More information about the File
mailing list