groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to crash the formatter with a dummy character (was: troff -Tpdf: '.'


From: G. Branden Robinson
Subject: How to crash the formatter with a dummy character (was: troff -Tpdf: '.' in SS macro)
Date: Sat, 17 Feb 2024 11:23:11 -0600

Hi Alex,

I regret to ask you to work around this problem in Linux man-pages at
the man(7) document source level for the time being.

In other words, if you have a (sub)section heading that starts with ' or
., please prefix it with the dummy character yourself in man(7) source.

.SS ".profile and .bashrc"

should become

.SS "\&.profile and .bashrc"

Here's why.

At 2024-02-16T16:51:04+0100, Alejandro Colomar wrote:
> > At 2024-02-16T01:44:36+0100, Alejandro Colomar wrote:
> > Yes, I can reproduce this with groff 1.23.0 and Git HEAD.
> > 
> > Try this patch.
> > 
> > diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
> > index 54175434f..fe12d35da 100644
> > --- a/tmac/pdf.tmac
> > +++ b/tmac/pdf.tmac
> > @@ -253,7 +253,7 @@ .de pdfbookmark
> >  .         tr \[em]-
> >  .         nf
> >  .         box pdf:clean
> > -.         nop \\$*
> > +.         nop \&\\$*
> >  .         fl
> >  .         box
> >  .         chop pdf:clean

This innocuous patch ripped the lid off of Hell.

Something about this diversion management--I thought it was the use of
`chop` and/or `asciify` later but it appears not to be--causes the
formatter to crash ("on purpose", due to the failure of an assertion
James Clark put in 33+ years ago), including when generating the
"mom-pdf.pdf" document.

That's a regression much too harsh to live with.  Plus, macrology should
_never_ be able to break formatter invariants, which is what assertions
ensure.

The problem has to do with the "input level"[1] and is therefore
super-fundamental to the parser's operation.

I have no idea when I will be able to resolve this problem.  I'm adding
an XFAIL test for the man(7) section titling problem, and I also have
some further tests exercising the same issue in a small mom(7) document
and a raw groff document targeting the "pdf" output device that I will
probably also check in, so that it is easier for me to tell when I break
or fix this issue.  (XPASS is reported like a failure--"Hey, stop, dude!
You accidentally fixed a bug!  Good job!  Now update the Automake
file!".)

I'm attaching those reproducers in case anyone wants to play with them.
Note, you have to apply the seemingly-innocuous patch above to provoke
an explosion.

I'm tracking this headache in Savannah #65322.

https://savannah.gnu.org/bugs/?65322

Regards,
Branden

[1] roughly, the nesting depth of complex expressions like
    \n[\*[mystr!\n[index]]], but also involving things like sprung traps

Attachment: heading.mom
Description: heading.mom

Attachment: pdfbookmark.groff
Description: pdfbookmark.groff

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]