[File] [PATCH] Magdir/windows CloneCD *.CCD described as Generic INI

Jörg Jenderek joerg.jen.der.ek at gmx.net
Fri Mar 10 22:13:56 UTC 2023

Hash: SHA1


Some days ago i handle some CD-ROM images. The standard format has a
suffix like iso. But especially on Windows also some other formats
are used. One format use CCD as suffix. When running file command
version 5.44 and newer on such CCD samples i get an output like:

ultraiso11.ccd: Generic INItialization configuration [Disc]

Then of course with option --extension only generic ini/inf instead
of 3 byte sequence ccd is shown and with -i option only
application/x-wine-extension-ini mime type is shown.

When excluding the test consulting magic file by option -e soft now i
get an output like:
ultraiso11.ccd: ASCII text, with CRLF line terminators
Here now generic mime type text/plain is shown.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). The samples are
also described with low priority as "Generic INI configuration" by
ini.trid.xml. The samples are described with high priority as
"CloneCD CDImage (description)" by cdimage-clonecd-cue.trid.xml
with correct suffix CCD. But here only application/octet-stream as
generic mime type is shown (See appended trid-v-ccd.txt.gz).

For comparison reason i also run the file format identification
utility DROID ( See https://sourceforge.net/projects/droid/).
Here my CCD examples are described as "CloneCD Control File" by PUID
fmt/1760. Here also correct extension CCD is shown, but mime type
field is empty (See appended droid-ccd.csv.gz).

The INI based samples should be recognized by subroutine ini-file
inside Magdir/windows. If the samples are only described as Generic
INItialization configuration that means a suited branch for sub
classification is missing inside sub routine.

The first step in sub routine is look for left bracket which is the
beginning of section.

Then look for known keywords or section names. If it find one then
display specific describing text with corresponding mime type and
file suffix. For the Windows Boot Loader this for example looks like:
 >>&0	regex/c	\^boot\x20loader]	Windows boot.ini
 !:mime application/x-wine-extension-ini
 !:ext	ini

Unfortunately the rules for INI file are not so strict. So it can
happens that the relevant section name is not the first one.
So if no known keyword is found after opening bracket, then look for
bracket of second section. This is done by lines like:
 >>&0	default				x
 >>>&0	search/8192			[
Then look again for known keyword like before. So some Windows setup
INFormation are detected now. If no known keyword is found in second
section than handle such samples by lines like:
 >>>>&0	default				x
 >>>>>&0	ubyte				x
 >>>>>>&-1 regex/T \^([A-Za-z0-9_\(\)\ ]+)\]\r	\
	Generic INItialization configuration [%-.40s
 !:mime	application/x-wine-extension-ini
 !:ext	ini/inf

So for my CCD examples the second section line entry [Disc] is here

Unfortunately i found no page about the used text file format for
CCD. But with the help of TrID command i found sufficient pages
CloneCD and the corresponding Control File on Wikipedia. That is
expressed by comment lines like:
# URL:		https://en.wikipedia.org/wiki/CloneCD
# Reference:	https://en.wikipedia.org/wiki/CloneCD_Control_File
#		http://mark0.net/download/triddefs_xml.7z
#		defs/c/cdimage-clonecd-cue.trid.xml
According to TrID, DROID and Wikipedia the first line looks like:
So i choose this as test criterium. So in branch handling first
section after last entry handling Flatpack and before handling
second section names this is now done by additional lines like:
>> &0	string		CloneCD]	CloneCD CD-image Description
!:mime	text/x-ccd
!:ext	ccd
Because the CCD files are just "simply text" files i could choose
generic mime type text/plain. But instead i choose a more suited user
defined text type. There exist other files with CCD suffix ( like
CorelCAD Drawing) but these seems to be not text files.

After applying the above mentioned modifications by patch
file-windows-ccd.diff then my samples are now described
with more details and correct name suffix. This now then looks like:

ultraiso11.ccd: CloneCD CD-image Description

I hope my diff file can be applied in future version of file
utility. Especially for people willing to switch to Linux (like the
author of ccd2iso tool) from Windows with personal files with formats
suited for Windows.

As far as i can see there exist more CD-images formats used mainly on
Windows, which are not recognized by file command.

With best wishes,
Jörg Jenderek
- --
Jörg Jenderek
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: droid-ccd.csv.gz
Type: application/x-gzip
Size: 258 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230310/d5591319/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-ccd.txt.gz
Type: application/x-gzip
Size: 502 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230310/d5591319/attachment-0001.bin>
-------------- next part --------------
--- file-master/magic/Magdir/windows.old	2023-03-10 22:53:01.041200000 +0100
+++ file-master/magic/Magdir/windows	2023-03-10 22:59:14.468847100 +0100
@@ -839,4 +839,13 @@
 !:mime	application/vnd.flatpak.ref
 !:ext	flatpakref
+# From:		Joerg Jenderek
+# URL:		https://en.wikipedia.org/wiki/CloneCD
+# Reference:	https://en.wikipedia.org/wiki/CloneCD_Control_File
+#		http://mark0.net/download/triddefs_xml.7z/defs/c/cdimage-clonecd-cue.trid.xml
+# Note:		called "CloneCD CDImage (description)" by TrID and "CloneCD Control File" by DROID via PUID fmt/1760
+>>&0	string		CloneCD]					CloneCD CD-image Description
+#!:mime	text/plain
+!:mime	text/x-ccd
+!:ext	ccd
 # unknown keyword after opening bracket
 >>&0	default				x
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-windows-ccd.diff.sig
Type: application/octet-stream
Size: 599 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20230310/d5591319/attachment.obj>

More information about the File mailing list