[File] [PATCH] of Magdir/archive for OpenDocument; templates, extensions

Jörg Jenderek joerg.jen.der.ek at gmx.net
Mon Mar 9 13:47:55 UTC 2020


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hello,

some days ago i handled many ZIP archives. Some are just containers
used to store OpenDocument files (*.od?) or templates (*.ot?).

When running file command i get sometimes strange results. Then for
comparison reasons i create some test files according to OpenDocument
rules. When running file command version 5.38 on such OpenDocuments i
get an output like:

CD Envelope Template 1_2.otg:     OpenDocument Template
firebird_integer_ods12.odb:       OpenDocument Database
manual_DE.odm:                    OpenDocument Master Document
manual_EN.odt:                    OpenDocument Text
Modern_business_letter_serif.ott: OpenDocument Text Template
My-odf.odf:                       OpenDocument Formula
My-oth.oth:                       OpenDocument HTML Document Template
ooo_20_basis.otp:                 OpenDocument Template
OOoReise.ots:                     OpenDocument Template
PDF Feature Matrix.ods:           OpenDocument Spreadsheet
SimplePresentation.odp:           OpenDocument Presentation
test-database.odb:                OpenDocument Database
test-odc.odc:                     OpenDocument Chart
test-odi.odi:                     OpenDocument Image
test-otc.otc:                     OpenDocument Template
test-otf.otf:                     OpenDocument Template
test-oti.oti:                     OpenDocument Template
UBCDLABEL.odg:                    OpenDocument Drawing

For many templates only "OpenDocument Template" is shown without sub
type classification. So for example OOoReise.ots the precisely phrase
OpenDocument Spreadsheet Template should be shown. On the other hand
for some sub classes the correct type is displayed like "OpenDocument
Text Template" for example Modern_business_letter_serif.ott.
Furthermore with --extension option only ??? is displayed.

Unfortunately the Wikipedia about OpenDocument does not mention all
available sub types. So i take information about OpenDocument file
format found at file formats archive team. So i add to Magdir/archive
a comment line like
 #   URL: http://fileformats.archiveteam.org/wiki/OpenDocument

Inside Magdir/archive the part for OpenDocument Spreadsheet Template
looks like
 >>>>84	string	-template		Template
 !:mime	application/vnd.oasis.opendocument.spreadsheet-template

So i add sub type description before template phrase and after mime
type line i add line to show file name extension. So this now looks l
ike
 >>>>84	string	-template		Spreadsheet Template
 !:mime	application/vnd.oasis.opendocument.spreadsheet-template
 !:ext	ots
Then do the the same procedure for the other incomplete OpenDocument
templates.

In older OpenOffice 1.x databases "application/vnd.sun.xml.base" was
used as mime type. In newer OpenDocument type changed officially
registered at IANA to "application/vnd.oasis.opendocument.database"
with sub type database instead base. Unfortunately there exist a bug,
that also the base sub type is used as mime type inside ZIP packed
oth files. So 2 variants for OTH samples exist. That is expressed by
magic lines

 >>>73	string	database		Database
 !:mime	application/vnd.oasis.opendocument.database
 !:ext	odb
 #
 >>>73	string	base 			Database
 !:mime	application/vnd.oasis.opendocument.database
 !:ext	odb

After applying the above mentioned modifications by patch
file-5.38-archive-OpenDocument.diff then i get output with precise
sub class descriptions and correct file names extension like:

CD Envelope Template 1_2.otg:     OpenDocument Drawing Template
firebird_integer_ods12.odb:       OpenDocument Database
manual_DE.odm:                    OpenDocument Master Document
manual_EN.odt:                    OpenDocument Text
Modern_business_letter_serif.ott: OpenDocument Text Template
My-odf.odf:                       OpenDocument Formula
My-oth.oth:                       OpenDocument HTML Document Template
ooo_20_basis.otp:                 OpenDocument Presentation Template
OOoReise.ots:                     OpenDocument Spreadsheet Template
PDF Feature Matrix.ods:           OpenDocument Spreadsheet
SimplePresentation.odp:           OpenDocument Presentation
test-database.odb:                OpenDocument Database
test-odc.odc:                     OpenDocument Chart
test-odi.odi:                     OpenDocument Image
test-otc.otc:                     OpenDocument Chart Template
test-otf.otf:                     OpenDocument Formula Template
test-oti.oti:                     OpenDocument Image Template
UBCDLABEL.odg:                    OpenDocument Drawing

I hope my diff file can be applied in future version of
file utility.

With best wishes
Jörg Jenderek
- --
Jörg Jenderek





-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXmZI8wAKCRCv8rHJQhrU
1h8xAJ4xEO3MALYRtjR/yHO/orahWHkyCQCcCdwCAGPCWIjynrd4BBfPEIgvGZc=
=Qk1h
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.38/magic/Magdir/archive.old	2019-11-15 21:03:14 +0000
+++ file-5.38/magic/Magdir/archive	2020-03-08 20:10:37 +0000
@@ -1144,2 +1144,3 @@
 #   OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
+#   URL: http://fileformats.archiveteam.org/wiki/OpenDocument
 #    https://lists.oasis-open.org/archives/office/200505/msg00006.html
@@ -1150,8 +1151,12 @@
 !:mime	application/vnd.oasis.opendocument.text
+!:ext	odt
 >>>>77	string	-template		Text Template
 !:mime	application/vnd.oasis.opendocument.text-template
+!:ext	ott
 >>>>77	string	-web			HTML Document Template
 !:mime	application/vnd.oasis.opendocument.text-web
+!:ext	oth
 >>>>77	string	-master			Master Document
 !:mime	application/vnd.oasis.opendocument.text-master
+!:ext	odm
 >>>73	string	graphics
@@ -1159,4 +1164,6 @@
 !:mime	application/vnd.oasis.opendocument.graphics
->>>>81	string	-template		Template
+!:ext	odg
+>>>>81	string	-template		Drawing Template
 !:mime	application/vnd.oasis.opendocument.graphics-template
+!:ext	otg
 >>>73	string	presentation
@@ -1164,4 +1171,6 @@
 !:mime	application/vnd.oasis.opendocument.presentation
->>>>85	string	-template		Template
+!:ext	odp
+>>>>85	string	-template		Presentation Template
 !:mime	application/vnd.oasis.opendocument.presentation-template
+!:ext	otp
 >>>73	string	spreadsheet
@@ -1169,4 +1178,6 @@
 !:mime	application/vnd.oasis.opendocument.spreadsheet
->>>>84	string	-template		Template
+!:ext	ods
+>>>>84	string	-template		Spreadsheet Template
 !:mime	application/vnd.oasis.opendocument.spreadsheet-template
+!:ext	ots
 >>>73	string	chart
@@ -1174,4 +1185,6 @@
 !:mime	application/vnd.oasis.opendocument.chart
->>>>78	string	-template		Template
+!:ext	odc
+>>>>78	string	-template		Chart Template
 !:mime	application/vnd.oasis.opendocument.chart-template
+!:ext	otc
 >>>73	string	formula
@@ -1179,9 +1192,16 @@
 !:mime	application/vnd.oasis.opendocument.formula
->>>>80	string	-template		Template
+!:ext	odf
+>>>>80	string	-template		Formula Template
 !:mime	application/vnd.oasis.opendocument.formula-template
+!:ext	otf
+# https://www.loc.gov/preservation/digital/formats/fdd/fdd000441.shtml
 >>>73	string	database		Database
 !:mime	application/vnd.oasis.opendocument.database
+!:ext	odb
 # Valid for LibreOffice Base 6.0.1.1 at least
 >>>73	string	base 			Database
-!:mime	application/vnd.oasis.opendocument.base
+# https://bugs.documentfoundation.org/show_bug.cgi?id=45854
+!:mime	application/vnd.oasis.opendocument.database
+#!:mime	application/vnd.oasis.opendocument.base
+!:ext	odb
 >>>73	string	image
@@ -1189,4 +1209,6 @@
 !:mime	application/vnd.oasis.opendocument.image
->>>>78	string	-template		Template
+!:ext	odi
+>>>>78	string	-template		Image Template
 !:mime	application/vnd.oasis.opendocument.image-template
+!:ext	oti
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.38-archive-OpenDocument.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20200309/a4e34d46/attachment.obj>


More information about the File mailing list