[File] [PATCH] of Magdir/macintosh,uuencode for BinHex binary; *.hqx
Christos Zoulas
christos at zoulas.com
Sat Dec 14 20:40:40 UTC 2019
Committed, thanks!
christos
> On Dec 14, 2019, at 9:26 AM, Jörg Jenderek <joerg.jen.der.ek at gmx.net> wrote:
>
> Hello,
>
> some days ago i handled some BinHex binaries. When searching on my
> systems and the internet for such files and similar test files and
> running file command version 5.37 with -k option i get unexpected
> output like:
>
> mac-update-40b7.hqx: news or mail, ASCII text
> MACDEV6B.HQX: BinHex binary text, version 4.0\012-
> BinHex binary text, version 4.0, ASCII text
> RESRC_DE.HQX: ASCII text
> shrinkwrap-21.hqx: BinHex binary text, version 4.0\012-
> BinHex binary text, version 4.0, ASCII text
> zap-res-forks-101.hqx: data
>
> Furthermore with --extension only ??? is displayed.
> First of all i get duplicate messages. One is triggered by line
> inside Magdir/macintosh looking like:
> 11 string must\ be\ converted\ with\ BinHex BinHex binary text
> The other message is triggered by nearly same magic inside
> Magdir/uuencode looking like
> 11 search/1 must\ be\ converted\ with\ BinHex BinHex binary text
>
> Most information about this file format ca be found on Wikipedia. So
> i add a comment line like
> # URL: https://en.wikipedia.org/wiki/BinHex
>
> According to documentations the characteristic magic for BinHex is a
> sentence starting like:
> (This file must be converted with BinHex
>
> For most inspected examples this sentence is found at offset 0 of
> file. But sometimes one empty line is before the sentence. This
> should be matched only by magic inside Magdir/uuencode. And according
> to RFC 1741 any text before this magic sentence is to be ignored. So
> there exist samples with text consisting of thousand characters
> before magic sentence like in mac-update-40b7.hqx found on
> ftp.vim.org. So search range must be raised.
>
> Furthermore another error occurs. The "string" and "search" directive
> used at the moment only works for text files and not binary
> considered files. So examples like zap-res-forks-101.hqx also found
> on ftp.vim.org are described by file command only as "binary" data.
> When looking in that file i find control-characters like ^C and a
> copyright symbol like ©. So this file is not ASCII text and must be
> handled as binary. The magic test lines now become like
>
> 0 search/1602 (This\ file\
>> &0 use binhex
> 0 search/2652/b (This\ file\
>> &0 use binhex
> 0 name binhex
>> 0 string must\ be\ converted\ with\ BinHex\ BinHex binary text
> The first search directive is for ASCII text samples and the second
> is for binary branch.
>
> Now afterwards show apple type according to web site www.macdisk.com
> by line
> !:apple BNHQTEXT
>
> At the end of the sentence the version is stored. This is shown
> at the moment in current magic files by lines
>> 41 string x \b, version %.3s
>
> The documentation mainly mentions version 4.0 and i only found test
> examples with version 4.0 and hqx extension. But according to
> www.faqs.org and Wikipedia for other versions different file name
> extensions and maybe different mime types are used, but the
> description are not so precisely. I have done my best. Maybe an
> BinHex expert should check this. So depending on version this is now
> described by
>>> &0 string 1.0 1.0
> !:mime application/mac-binhex
> !:ext hex
>>> &0 string 2.0 2.0
> !:mime application/mac-binhex
> !:ext hcx
>>> &0 string 4.0 4.0
> !:mime application/mac-binhex40
> !:ext hqx
>>> &0 string 5.0 5.0
> !:mime application/mac-binhex40
> !:ext hqx
>>> &0 default x
>>>> &0 string x %.3s
> !:mime application/mac-binhex
> !:ext hqx
>
> After applying the above mentioned modifications by patches
> file-5.37-uuencode-macbin.diff and file-5.37-macintosh-macbin.diff
> the duplicate messages vanish. Further more now cases with garbage
> before magic sentence and binary looking files are also recognised
> and i get an output like:
>
> mac-update-40b7.hqx: news or mail text
> BinHex binary text, version 4.0, ASCII text
> MACDEV6B.HQX: BinHex binary text, version 4.0, ASCII text
> RESRC_DE.HQX: BinHex binary text, version 4.0, ASCII text
> shrinkwrap-21.hqx: BinHex binary text, version 4.0, ASCII text
> zap-res-forks-101.hqx: BinHex binary text, version 4.0\012- data
>
> I hope my diff files can be applied in a future version of
> file utility.
>
> With best wishes
> Jörg Jenderek
> --
> Jörg Jenderek
>
>
>
>
>
>
>
>
> <file-5_37-uuencode-macbin_diff.DEFANGED-1><file-5_37-macintosh-macbin_diff.DEFANGED-2>--
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20191214/ea6f002b/attachment.asc>
More information about the File
mailing list