[File] [PATCH] of Magdir/wordprocessors Star/Libre-Office Gallery theme misidentified T6.PRF

Jörg Jenderek joerg.jen.der.ek at gmx.net
Fri Aug 20 00:38:40 UTC 2021


Hello,

some days ago i inspected some dBase examples. Now i looked at dBase
examples with PRF extension together with StarOffice/Libre-Office
Gallery themes with THM file name extension.

When running running file command version 5.40 on such examples and
related files i get an output like:

diagrams.thm:     StarOffice Gallery theme
		  Diagrams, 59 objects,
		  1st dd2343
file2147.chk:     data
neues thema6.thm: StarOffice Gallery theme
          	  MorePictures, 315 objects,
		  1st file:///C:/Users/joerg/Pictures/
		  1999_1024_23_Tikal.jpg
sg13.thm:         StarOffice Gallery theme
		  Flussdiagramme, 18 objects,
		  1st dd2037
sg16.thm:         StarOffice Gallery theme
		  3D, 12 objects,
		  1st dd2066
sg27.thm:         StarOffice Gallery theme
		  Navigation, 238 objects,
		  1st /navi%2D2d/wh%5Fup.gif
sg30.thm:         StarOffice Gallery theme
		  private://gallery/hidden/usersounds, 0 objects
sg33.thm:         StarOffice Gallery theme
		  Problemlösungen, 72 objects,
		  1st /troubleshooting/question-mark_blue.wmf
sg601.thm:        StarOffice Gallery theme
		  Cisco - WAN - LAN, 33 objects,
		  1st dd2194
sounds.thm:       StarOffice Gallery theme
		  sounds, 35 objects,
		  1st /sounds/apert2.wav
symbolshapes.thm: StarOffice Gallery theme
		  private://gallery/hidden/imgppt, 45 objects,
		  1st dd2075
T6.PRF:           StarOffice Gallery theme
		  :\DBASE\IV\T6.txts

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This describes these
examples as "StarOffice Gallery theme" by definition
thm-staroffice.trid.xml and does not misidentifies dBase T6.PRF
example (See appended thm_office-trid-v.txt.gz)

TrID uses another method to identify files. So i add the TrID
definition as URL by comment lines. This is now expressed by
additional lines inside Magdir/wordprocessors like:
  # Reference:	http://mark0.net/download/triddefs_xml.7z
  #		/defs/t/thm-staroffice.trid.xml

The identification happen inside Magdir/wordprocessors by 2 starting
test lines like:
  0		ubeshort	0x0400
  >2		uleshort	>0	StarOffice Gallery theme
By second test for positive length of gallery name a misidentified
example file2147.chk was skipped.
Later this gallery name is shown by line like:
  >> 2		pstring/h	x		%s
This is typically one word (like 3D sounds Diagrams Flussdiagramme
Fotos) or sometimes more words ( like "Cisco - WAN - LAN" ) or
URL-like private://gallery/hidden/imgppt.

For misidentified dBase printer form T6.PRF ":\DBASE\IV\T6.txts" is
shown as Gallery name. That file is found in Erik Bachmann dBase
example archive dbase_ex.zip. But in reality this is part of the
dBase printer output DOS file name "E:\DBASE\IV\T6.txt". So a third
test is needed to avoid misidentification of this dBase example.

Later the number of Gallery objects and the name of first object is
shown by lines like:
  >>(2.s+4)	ulelong		x		\b, %u object
  >>(2.s+4)	ulelong		>0
  >>>(2.s+11)	pstring/h	x		\b, 1st %s

For debugging purpose this last thing can also be done by additional
lines like:
  >>(2.s+13)	string	x \b, possible OBEJECT NAME "%s"
  >>(2.s+13)	ubyte   x \b, 1st CHAR %c of possible OBJECT NAME

For examples with positive object numbers again the first object name
and the first character of it is shown. But for examples with zero
objects also something is shown. That seems to be always the string
RESRV of keyword GALRESRV.

So i skipped bad example T6.PRF by check of first character  of
object name or RESRV string as third test line like:
>>(2.s+13)	ubyte		>0x1F	StarOffice Gallery theme

After applying the above mentioned modifications by patch
file-5.40-wordprocessors-thm.diff then such Office THM examples are
still described but misidentification of others vanish like:

diagrams.thm:     StarOffice Gallery theme
		  Diagrams, 59 objects,
		  1st dd2343
file2147.chk:     data
neues thema6.thm: StarOffice Gallery theme
        		  MorePictures, 315 objects,
		  1st file:///C:/Users/joerg/Pictures/
		  1999_1024_23_Tikal.jpg
sg13.thm:         StarOffice Gallery theme
		  Flussdiagramme, 18 objects,
		  1st dd2037
sg16.thm:         StarOffice Gallery theme
		  3D, 12 objects,
		  1st dd2066
sg27.thm:         StarOffice Gallery theme
		  Navigation, 238 objects,
		  1st /navi%2D2d/wh%5Fup.gif
sg30.thm:         StarOffice Gallery theme
		  private://gallery/hidden/usersounds, 0 objects
sg33.thm:         StarOffice Gallery theme
		  Problemlösungen, 72 objects,
		  1st /troubleshooting/question-mark_blue.wmf
sg601.thm:        StarOffice Gallery theme
		  Cisco - WAN - LAN, 33 objects,
		  1st dd2194
sounds.thm:       StarOffice Gallery theme
		  sounds, 35 objects,
		  1st /sounds/apert2.wav
symbolshapes.thm: StarOffice Gallery theme
		  private://gallery/hidden/imgppt, 45 objects,
		  1st dd2075
T6.PRF:           data

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

I will try to create magic lines for dBase PRN examples in a future
session.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: thm_office-trid-v.txt.gz
Type: application/x-gzip
Size: 692 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210820/5d1f56c3/attachment.bin>
-------------- next part --------------
--- file-5.40/magic/Magdir/wordprocessors.old	2021-02-22 23:49:24 +0000
+++ file-5.40/magic/Magdir/wordprocessors	2021-08-20 00:27:33 +0000
@@ -277,2 +277,4 @@
 # URL:		https://en.wikipedia.org/wiki/StarOffice
+# Reference:	http://mark0.net/download/triddefs_xml.7z
+#		/defs/t/thm-staroffice.trid.xml
 # Note:		used in Star-, Open- and Libre-Office
@@ -280,2 +282,3 @@
 0		ubeshort	0x0400
+# non nil gap
 #>(2.s+8)	ubequad		x		\b, gap 0x%16.16llx
@@ -290,15 +293,23 @@
 # skip file2147.chk by check for positive name length like for sg16.thm "3D"
->2		uleshort	>0		StarOffice Gallery theme
+>2		uleshort	>0
+# skip dBase printer form T6.PRF with misidentified gallery 
+# name :\DBASE\IV\T6.txts by check for 1st object name or RESRV keyword
+# https://www.clicketyclick.dk/databases/xbase/xbase/dbase_ex.zip
+# template/t6/with_data/T6.PRF
+# by first char of object name or RESRV part of keyword GALRESRV
+>>(2.s+13)	ubyte		>0x1F		StarOffice Gallery theme
 !:mime		application/x-stargallery-thm
+# thm is also used for JPEG thumbnail images
 !:ext		thm
-# gallery name
->>2		pstring/h	x		%s
+# gallery name often 1 word like: 3D sounds Diagrams Flussdiagramme Fotos
+# or like private://gallery/hidden/imgppt "Cisco - WAN - LAN"
+>>>2		pstring/h	x		%s
 # number of objects
->>(2.s+4)	ulelong		x		\b, %u object
+>>>(2.s+4)	ulelong		x		\b, %u object
 # plural s
->>(2.s+4)	ulelong		!1		\bs
+>>>(2.s+4)	ulelong		!1		\bs
 # if available then display first object name 
->>(2.s+4)	ulelong		>0
+>>>(2.s+4)	ulelong		>0
 # partial file name, URL or internal name like "dd2*" of 1st object or RESRV
->>>(2.s+11)	pstring/h	x		\b, 1st %s
+>>>>(2.s+11)	pstring/h	x		\b, 1st %s
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.40-wordprocessors-thm.diff.sig
Type: application/octet-stream
Size: 1052 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210820/5d1f56c3/attachment.obj>


More information about the File mailing list