[File] [PATCH] magic/Magdir/typeset: detect Fabylon FAB2 book container (.fab)
Christos Zoulas
christos at zoulas.com
Mon Aug 17 04:58:48 EDT 2026
Added, thanks!
christos
> On Aug 17, 2026, at 9:41 AM, Martijn Benders <m.benders at gmail.com> wrote:
>
> Hello,
>
> A small magic patch adding detection for the FAB2 book container, extension .fab.
> I am the developer of the format's specification, so the byte sequence below is
> authoritative rather than reverse-engineered.
>
> The signature is a fixed 16-byte ASCII string at offset 0, with no preceding
> bytes. The container generation is inside the magic string itself, which is why
> the patch matches the exact string rather than a prefix.
>
> ASCII FABYLON_BOOK_02!
> Hex 46 41 42 59 4C 4F 4E 5F 42 4F 4F 4B 5F 30 32 21
>
> Placed in Magdir/typeset because the container stores typeset output — resolved
> line geometry rather than reflowable markup. Move it if you would rather it lived
> elsewhere.
>
> --- typeset.orig
> +++ https://www.google.com/url?q=http://typeset.new&source=gmail&ust=1787035263307000&sa=E
> @@ -6,3 +6,7 @@
> 0 string Interpress/Xerox Xerox InterPress data
> >16 string / (version
> >>17 string >\0 %s)
> +0 string FABYLON_BOOK_02! Fabylon FAB2 book container
> +!:ext fab
> +0 string FABYLON_REALM_01 Fabylon book container (legacy)
> +!:ext fab
>
> TESTED with file-5.48. The patched typeset file compiles clean with `file -C -m`,
> and:
>
> real .fab file -> Fabylon FAB2 book container
> FABYLON_REALM_01 header -> Fabylon book container (legacy)
> FABYLON_BOOK_03! header -> no match (correct: an unknown future generation
> must not be claimed as FAB2)
> PDF and EPUB -> no match
>
> Before the patch a .fab is reported as plain "data" /
> "application/octet-stream".
>
> A publicly downloadable test file, 10266 bytes:
>
> https://www.google.com/url?q=https://github.com/mbenders/fab-format/blob/master/samples/fab-book-format-en.fab&source=gmail&ust=1787035263307000&sa=E
>
> Specification:
>
> https://www.google.com/url?q=https://fabylon.net/fab/specification/&source=gmail&ust=1787035263307000&sa=E
>
> I have deliberately left out a `!:mime` line. A vendor-tree registration for
> application/vnd.fabylon.book was submitted to IANA on 2026-08-17 and is not yet
> approved, and I did not want to put an unregistered type in your database. Once
> IANA confirms I will send a one-line follow-up patch adding it, if you would like
> that.
>
> The legacy FABYLON_REALM_01 entry covers an earlier generation with a different
> internal structure. Current software still reads it; nothing writes it any more.
> Drop that hunk if you would rather not carry a retired generation.
>
> Thanks for file(1) — it has been the first thing I reach for on an unknown file
> for twenty years.
>
> Kind regards,
>
> M.H.H. Benders
> Fabylon, Karjalohja, Finland
> m.benders at fabylon.net <mailto:m.benders at fabylon.net>
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.astron.com/pipermail/file/attachments/20260817/1f79d677/attachment-0001.htm>
More information about the File
mailing list