[File] [PATCH] Magdir/iff IFF data, PTCH binary patch; missing extensions

Christos Zoulas christos at zoulas.com
Fri Feb 9 00:44:57 UTC 2024


Committed, thanks!

christos

> On Feb 7, 2024, at 5:40 PM, Jörg Jenderek (GMX) <joerg.jen.der.ek at gmx.net> wrote:
> 
> 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
> <file-iff-pch_diff.DEFANGED-11636><file-iff-pch_diff_sig.DEFANGED-11637><trid-v-iff-pch.txt.gz>-- 
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>



More information about the File mailing list