URL: <https://savannah.gnu.org/bugs/?66339>
Summary: [ms] cannot start a document with a `DS` static display Group: GNU roff Submitter: gbranden Submitted: Wed 16 Oct 2024 05:50:36 PM UTC Category: Macro package ms Severity: 3 - Normal Item Group: Incorrect behaviour Status: In Progress Privacy: Public Assigned to: gbranden Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Wed 16 Oct 2024 05:50:36 PM UTC By: G. Branden Robinson <gbranden> Affects _groff_ 1.23.0. $ cat ATTIC/start-with-display.ms .DS Hello, world! .s=\n(.s, nl=\n(nl .DE $ /usr/bin/groff --version | head -n 1 GNU groff version 1.22.4 $ /usr/bin/groff -a -ms ATTIC/start-with-display.ms <beginning of page> Hello, world! .s=10, nl=72000 $ ~/groff-stable/bin/groff --version | head -n 1 GNU groff version 1.23.0 $ ~/groff-stable/bin/groff -a -ms ATTIC/start-with-display.ms <beginning of page> s.tmac:ATTIC/start-with-display.ms:3: error: must be in top-level environment, not 'nf', when first page is started Hello, world! .s=1, nl=-1 Analysis from a [https://lists.gnu.org/archive/html/groff/2024-10/msg00090.html post to the groff mailing list]: It appears to me that this was a bug I introduced.[1] I bisected it down to commit 1887bbe68c in November 2021. The fix is simple, and causes no automated test failures (but I'll be writing a new one); here's what I have in my working copy. $ git diff diff --git a/tmac/s.tmac b/tmac/s.tmac index dd682e5b1..adf18e0c7 100644 --- a/tmac/s.tmac +++ b/tmac/s.tmac @@ -1071,6 +1071,7 @@ .de ds*end!2 .el .@error-recover mismatched .DE .. .de DS +.br .if '\\n(.z'ds*div' .@error-recover cannot begin display within display .nr ds*badarg 0 .di ds*div ... [1] The lack of `br` meant that a document that started with a `DS` macro call did not "sweep" the drawing position past vertical position 0, which springs a trap that calls a macro called `cov*first-page-init`,[2] which does much essential initialization, including (indirectly) setup of the `PS` register storing the type size. Consequently, the text of the display would render at 1 point(!) instead of the formatter's default of 10. The diagnostic about the `nf` environment might warn the user that the formatting is likely to go awry, but we can do better than that by simply restoring the break. [2] https://git.savannah.gnu.org/cgit/groff.git/tree/tmac/s.tmac?id=198346d187de9e340bbf9d4f80c2dc4d42f5f74e#n203 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66339> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature