Control: tags 1026460 confirmed upstream

Hilmar Preusse wrote...

> Not sure if this is solvable, at the fist glance I found no magic byte
> for vf files.

Things are worse: file(1) /does/ have magic for "TeX virtual font data"
but is *that* weak (only 16 bit, 0xf7 0xca at the start of file) it gets
beaten by the pattern for the dreaded MS-DOS executables (which is plain
nightmare).

After some searching I found the parser for virtual font files in
texk/dvipsk/virtualfont.c starting at line 189. So I could harden the
magic at least a little bit by exploiting the command byte (243, 0xf3)
at offset 0xb the earliest.

Since I had to download the huge texlive-fonts-extra .deb to extract the
reproducer, this at least also brought more than 20k samples to verify
the result. Some .vf files fail the test, and I'd like to ask you
whether they are technically correct:

# From the texlive-bin sources (bullseye)

* texk/web2c/tests/badvpl.vpl (I assume that's not a bug)

# From texlive-fonts-extra_2022.20221123-2_all.deb:

* /usr/share/texlive/texmf-dist/fonts/vf/public/mathdesign/mdbch/mdbchbofc8t.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/mathdesign/mdbch/mdbchrofc8t.vf

They look fairly broken (error messages inside), perhaps they shouldn't
be there anyway?

* 
/usr/share/texlive/texmf-dist/fonts/vf/public/ebgaramond/EBGaramondInitials-tlf-ts1.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/gfsbodoni/gbodonio9a.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfoit0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfoit0700.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfost0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfost0700.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfotc0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfotc0700.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfott0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfott0700.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfovi0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfovi0700.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfovt0600.vf
* /usr/share/texlive/texmf-dist/fonts/vf/public/hfoldsty/hfovt0700.vf
* 
/usr/share/texlive/texmf-dist/fonts/vf/public/libertinus-type1/LibertinusSerifInitials-Regular-tlf-ts1.vf

These are pretty small (88 octets at most, usually just 12) so still not
having them detected properly might not be the biggest loss.


While on it, I'll dig a bit further so I can improve detection of other
TeX-related file types where file(1) isn't quite good at the moment,
being

* TeX DVI file
* TeX generic font data
* TeX packed font data

Cheers,

    Christoph

Attachment: signature.asc
Description: PGP signature

Reply via email to