[File] [PATCH] of Magdir/mail.news for Emacs RMAIL; update+mime+extension

Jörg Jenderek joerg.jen.der.ek at gmx.net
Fri Jun 21 10:46:57 UTC 2019


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

Hello,
some days ago i handle files starting with ASCII string "BA".
This should apply for Emacs RMAIL files, but when i run file command
version 5.37 on such mail examples and similar test files i get an
unexpected output like:

BABYLON.txt:      data
RMAIL:            data
RMAIL-test4.txt:  Emacs RMAIL, ASCII text

So i add/change lines in Magdir/mail.news. First i search for an file
format specification and add this URL as a comment line
 # Reference:	http://quimby.gnus.org/notes/BABYL

According to that reference described mail format start with phrase
"BABYL OPTIONS:". This seems to be matched at first glance by magic line
 0	string/t	BABYL			Emacs RMAIL text
but when looking in reference we see that such mail files contain
non ASCII characters like Control-L and Control-_. So such examples
are considered by file command as binary and not text files. So the
used magic line never be matched. So the /t flag in string
expression must be replaced by /b flag.

The used 5 byte magic "BABYL" is maybe to weak and is matched by
text file like BABYLON.txt which start with a sentence like "BABYLON
is the name of an ancient city". So the test line now becomes:
 0	string/b	BABYL\ OPTIONS:		Emacs RMAIL

According to mime sub page of web site reposcope.com gets an own
user defined mime typ. This is now expressed by line:
 !:mime	message/x-gnu-rmail
Such mail is normally stored in a file like ~/RMAIL. So this file
name has no extension. This is now expressed by line
 !:ext	/

After applying the above mentioned modifications by patch
file-5.37-mail.news-RMAIL.diff then unrecognized Emacs RMAIL is
now recognized, bad examples are skipped and described like

BABYLON.txt:     data
RMAIL:           Emacs RMAIL
RMAIL-test4.txt: ASCII text

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+v8rHJQhrU1gUCXQy1igAKCRCv8rHJQhrU
1qTbAKCKvvMx301x5vMY1rZBd+tAGnCemwCfbGawf5CR75OivKPFnXY7QPvdNCU=
=CRD/
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.37/magic/Magdir/mail.news.old	2019-04-19 00:42:27 +0000
+++ file-5.37/magic/Magdir/mail.news	2019-06-21 00:37:19 +0000
@@ -28,3 +28,12 @@
 !:mime	message/news
-0	string/t		BABYL		Emacs RMAIL text
+# Reference:	http://quimby.gnus.org/notes/BABYL
+# Update:	Joerg Jenderek
+# Note:		used by Rmail in Emacs version 22 and before
+#		is not text because of characters like Control-L Control-_
+0	string/b		BABYL\ OPTIONS:	Emacs RMAIL
+#0	string/t		BABYL		Emacs RMAIL text
+# https://reposcope.com/mimetype/message/x-gnu-rmail
+!:mime	message/x-gnu-rmail
+# ~/RMAIL
+!:ext	/
 0	string/t		Received:	RFC 822 mail text
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.37-mail.news-RMAIL.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20190621/7dd9928f/attachment.obj>


More information about the File mailing list