[File] [PATCH] of Magdir/archive for newer Corel Draw; *.cdr *.cdt *.cdrt
Christos Zoulas
christos at zoulas.com
Sat Aug 10 13:40:11 UTC 2019
On Aug 10, 3:14am, joerg.jen.der.ek at gmx.net (=?UTF-8?Q?J=c3=b6rg_Jenderek?=) wrote:
-- Subject: [File] [PATCH] of Magdir/archive for newer Corel Draw; *.cdr *.cd
| Hello,
| some weeks ago i handled some newer Corel Drawings. I run file command
| version 5.37 on such Corel Drawings with name extension cdr, cdt and
| cdrt for template. With -k -m Magdir/archive options i get an output
| like:
|
| 14-CMYKpages2VorschauUmriss.cdr: Zip data (MIME type
| "application/x-vnd.corel.draw.document+zip"?)
| 15-CMYKpages2VorschauUmriss.cdr: Zip data (MIME type
| "application/x-vnd.corel.draw.document+zip"?)
| 16-DentistEmbedFontsCMX.cdr: Zip data (MIME type
| "application/x-vnd.corel.draw.document+zip"?)
| 17-spray_flowers.cdr: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.document+zip"?)
| coreldraw2019-v14.cdrt: Zip data (MIME type
| "application/x-vnd.corel.draw.template+zip"?)
| coreldraw2019-v15.cdrt: Zip data (MIME type
| "application/x-vnd.corel.draw.template+zip"?)
| coreldraw2019-v16.3.cdrt: Zip data (MIME type
| "application/x-vnd.corel.draw.template+zip"?)
| coreldraw2019-v17.cdrt: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.template+zip"?)
| coreldraw2019-v19_2017.cdr: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.document+zip"?)
| coreldraw2019-v20_2018.cdr: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.document+zip"?)
| coreldraw2019-v21.cdr: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.document+zip"?)
| coreldraw2019-v21.cdrt: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.template+zip"?)
| drawX8.cdr: Zip data (MIME type
| "application/x-vnd.corel.zcf.draw.document+zip"?)
|
| Such samples are only recognized as generic ZIP archive with
| unrecognized MIME type starting with application/ .
|
| Furthermore with --extension option only ??? is displayed. And with -i
| option only application/zip is displayed.
|
| Most information can be found on CorelDraw page on Wikipedia. So i add
| a comment line:
| # URL: http://en.wikipedia.org/wiki/CorelDRAW
|
| According to Wikipedia there exist 3 different file formats for Corel
| CDR files. Til version 2 proprietary file format is used that is
| recognizable by the first two bytes of the file being "WL" and is not
| detected by file command. From Version 3 til 13 the file format
| changed to a Resource Interchange File Format (RIFF) container and
| partly detected by file command. From version X4 (14) on, the CDR file
| is a ZIP-compressed directory of several files, which are handled here
| .
|
| So i add in Magdir/archive after EPUB document entry lines for
| inspected Corel Draw samples. The mime type start with
| "application/x-vnd.corel". This is now detected by magic line
| >>50 string x-vnd.corel. Corel
|
| Afterwards add remaining mime type parts, which are different
| depending on version and file type by code segment
| >>>62 string draw.document+zip Draw drawing, version 14-16
| !:mime application/x-vnd.corel.draw.document+zip
| !:ext cdr
| >>>62 string draw.template+zip Draw template, version 14-16
| !:mime application/x-vnd.corel.draw.template+zip
| !:ext cdrt
| >>>62 string zcf.draw.document+zip Draw drawing, version 17-21
| !:mime application/x-vnd.corel.zcf.draw.document+zip
| !:ext cdr
| >>>62 string zcf.draw.template+zip Draw template, version 17-21
| !:mime application/x-vnd.corel.zcf.draw.template+zip
| !:ext cdt/cdrt
|
| At this point the message starting with phrase "Zip data (MIME type"
| still appears, because the branch to handle remaining unrecognized ZIP
| archives with mime type starting with "application/" are done in a
| specific way. That is is to exclude all ZIP archives with known mime
| type and then displaying mentioned phrase part. This looks like:
| >>50 string !epub+zip
| >>>50 string !vnd.oasis.opendocument.
| >>>>50 string !vnd.sun.xml.
| >>>>>50 string !vnd.kde.
| >>>>>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
|
| Of course i can add an additional line before regex expression to
| exclude Corel Draw like
| >>>>>>50 string !x-vnd.corel.
|
| Instead i use another way. After handling ZIP archives with known
| mime types match the remaining unrecognized by "default" test. This
| now looks:
| >>50 default x Zip data
| >>>38 regex [!-OQ-~]+ (MIME type "%s"?)
|
| After applying the above mentioned modifications by patch
| file-5.37-archive-coreldraw.diff then i get a more precise output like
| :
| 14-CMYKpages2VorschauUmriss.cdr: Corel Draw drawing, version 14-16
| 15-CMYKpages2VorschauUmriss.cdr: Corel Draw drawing, version 14-16
| 16-DentistEmbedFontsCMX.cdr: Corel Draw drawing, version 14-16
| 17-spray_flowers.cdr: Corel Draw drawing, version 17-21
| coreldraw2019-v14.cdrt: Corel Draw template,
| version 14-16
| coreldraw2019-v15.cdrt: Corel Draw template,
| version 14-16
| coreldraw2019-v16.3.cdrt: Corel Draw template,
| version 14-16
| coreldraw2019-v17.cdrt: Corel Draw template,
| version 17-21
| coreldraw2019-v19_2017.cdr: Corel Draw drawing, version 17-21
| coreldraw2019-v20_2018.cdr: Corel Draw drawing, version 17-21
| coreldraw2019-v21.cdr: Corel Draw drawing, version 17-21
| coreldraw2019-v21.cdrt: Corel Draw template,
| version 17-21
| drawX8.cdr: Corel Draw drawing, version 17-21
|
|
|
| I hope my diff file can be applied in future version of
| file utility.
Applied, thanks!
christos
More information about the File
mailing list