At 2022-11-02T01:16:12-0500, G. Branden Robinson wrote: > That isn't confirmed yet, but after also seeing the problem in > filesystems(5), slabinfo(5), and utmp(5), that's the way my nose hairs > are blowing.
Guess I should break out the trimmers; disabling the abbreviation logic did not remedy the problem. Nevertheless I found it after further sniffing. I have now undergone a rite of passage that many writers of *roff macro packages experience: stumbling over the landmine of end-of-input trap page-ejection behavior. This bug did not affect groff man(7) in 1.22.4; that isn't too much of a surprise because I rewrote continuous rendering support afterward. I _think_ the bug was latent in groff 1.22.4 mdoc(7), but I am not positive because headers and footers generally failed to appear in continuous rendering mode in that release for that package. Regardless, it's certainly present in groff Git master on Savannah now. But, not long ago I ported over groff man(7)'s continuous rendering handling to our mdoc(7), replacing the method it had been using--I don't know if I exposed the bug or merely created it. Rest assured, I have regression tests for this for both packages now. Please apply the attached patch to your groff sources. This will be in my next push. I have tried to explain the bug and fix clearly in comments and the ChangeLog but the problem is in one of the more damnably subtle aspects of formatter; witness the lengthy comment (that I recast), introduced by Werner way back in 2001. I welcome suggestions for clarification. Thank you very much for using the Linux man-pages corpus to help solidify groff man(7) for release. Regards, Branden
commit 1d939ccdf93a20e1bb9fb67b7aec52143706977b Author: G. Branden Robinson <[email protected]> Date: Wed Nov 2 03:15:03 2022 -0500 [man,mdoc]: Fix glitch in continuous rendering. * tmac/an.tmac (an-end): * tmac/mdoc/doc-common (doc-end-macro): Ensure that document footer appears in continuous rendering mode even when a final pending output line in the document is 1v from the page bottom. Replace `fl` call with `br`, which IMO has clearer semantics. Extend page length by 1v before doing so if the current vertical position is within 1v of the page bottom. * tmac/mdoc/doc-common (doc-end-macro): We now need to perform a dynamic calculation using registers, so unwrap macro definition with `eo`/`ec` requests, and double backslashes in escape sequences that are interpreted in copy mode. Thanks to Alex Colomar for the report. diff --git a/ChangeLog b/ChangeLog index 3f620e5c0..171a3c1fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2022-11-02 G. Branden Robinson <[email protected]> + + * tmac/an.tmac (an-end): + * tmac/mdoc/doc-common (doc-end-macro): Ensure that document + footer appears in continuous rendering mode even when a final + pending output line in the document is 1v from the page bottom. + Replace `fl` call with `br`, which IMO has clearer semantics. + Extend page length by 1v before doing so if the current vertical + position is within 1v of the page bottom. + + * tmac/mdoc/doc-common (doc-end-macro): We now need to perform a + dynamic calculation using registers, so unwrap macro definition + with `eo`/`ec` requests, and double backslashes in escape + sequences that are interpreted in copy mode. + + Thanks to Alex Colomar for the report. + 2022-11-02 G. Branden Robinson <[email protected]> [man, mdoc]: Regression-test special case of continuous diff --git a/tmac/an.tmac b/tmac/an.tmac index 3a38e1582..401ab45a7 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -111,7 +111,14 @@ .de1 an-end . if !r an-TH-was-called .return . if \\n[cR] \{\ -. fl +. \" We might have a pending output line that is not yet broken, and +. \" also be 1v from the bottom of the page. If we break (or flush) +. \" the output line now, the page will get ejected afterward and +. \" troff will exit because we're in an end-of-input macro--our +. \" footer will never be output. So, if that is the case, further +. \" extend the page length by 1v. +. if ((\\n[.p] - \\n[nl]) <= \\n[.V]) .pl +1v +. br . pl +1v . sp 1v . an-footer diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common index 3fe7ded24..b087d6308 100644 --- a/tmac/mdoc/doc-common +++ b/tmac/mdoc/doc-common @@ -1110,34 +1110,32 @@ .\" NS modifies: .\" NS doc-is-first-page-of-document . -.eo .de doc-end-macro -. \" We may still have a partial line in the environment. If this is -. \" the case, and we happen to be on the last line of the page, the -. \" '.fl' request will cause the page to be ejected and troff will -. \" immediately exit. If we are in nroff mode, this would be -. \" unfortunate, since we would never get a chance to output the -. \" footer. So we fudge the page length to make sure that the last -. \" page is never ejected until we want it to be. -. -. fl . doc-check-depth . -. if \n[cR] \{\ +. if \\n[cR] \{\ +. \" We might have a pending output line that is not yet broken, and +. \" also be 1v from the bottom of the page. If we break (or flush) +. \" the output line now, the page will get ejected afterward and +. \" troff will exit because we're in an end-of-input macro--our +. \" footer will never be output. So, if that is the case, further +. \" extend the page length by 1v. +. if ((\\n[.p] - \\n[nl]) <= \\n[.V]) .pl +1v +. br . pl +1v . sp 1v . doc-footer . \" If we're processing multiple documents and have started a new . \" one, draw a line between this footer and the next header. -. if !'\n[.F]'' \{\ +. if !'\\n[.F]'' \{\ . pl +1v . nf . ti 0 -\D'l \n[doc-line-length]u 0' +\D'l \\n[doc-line-length]u 0' . fi . \} . \" suppress empty lines after the footer -. pl \n[nl]u +. pl \\n[nl]u . \} . ch doc-header . bp @@ -1151,7 +1149,6 @@ . ds doc-operating-system \" empty . ds doc-topic-name \" empty .. -.ec . . .\" NS doc-paragraph macro
signature.asc
Description: PGP signature
