Version 1.25.0 released 2026-11-07 Systems like Arch and Manjaro Linux don't use Debian's approach to Ghostscript and URW font packaging. Our "configure" script should be looking only for the full URW fonts package, not Ghostscript's "Resource/Font" directory. If Ghostscript is installed, we can configure gropdf's "intermediate" service level at least, and the directory will be found by "BuildFoundries" when it parses the output of the "gs -h" command. What "configure" should be doing is finding the full URW fonts directory, and if found, setting "$urwfontsdir." It should not be looking for Ghostscript-provided fonts at all. We know that if the only URW fonts found are the ones supplied in Ghostscript's "Resource" font directory, there are not going to be any AFMs. `groff_have_urw_fonts` should be set only if the PFB files are found elsewhere. It suffices to have `$GHOSTSCRIPT != "missing"` to know that "intermediate" service is available. Tested by adding my Ghostscript "Resource/Font" to "groff.m4", hiding real URW fonts where "configure" won't find them, and reproducing the "check-urw-foundry.sh" test script failure observed on Manjaro. If I then remove that directory from "groff.m4" it then reports "intermediate" and the test passes. "configure" could look for AFM files as well, but it is unnecessary so long as we don't search paths matching "Resource/Font". Fixes . Thanks to Bruno Haible for the report. Fixes . Thanks to Nguyễn Gia Phong and Richard Purdie for the report. Feature prompted by surprising diagnosis of Lesk's "Notes on the IBM C Compiler." memo as a _me_(7) document instead of the more correct _ms_(7). The misdiagnosis appears to be due to the presence of lowercase macro calls, `ip` and `tp`, which happen to be defined by _me_(7). (There are other problems with the document, including a fascinating crime against the CSTR #49 specification of _tbl_ input that no contemporary implementation supports, and perhaps only Lesk himself knew about, being that program's author.) See ff. Fixes . Problem introduced by me in commit 4a4ef28a4e, 2 July. Thanks to Dave Kemper for the report. Fixes . Problem introduced by me in commit 85c8daa27d, 1 April. Thanks to Dave Kemper for the report. Fixes . Thanks to Colin Watson and Stephen Gildea for the reports and to them and Ingo Schwarze for discussion on the groff list. Fixes . Problem introduced by me in commit 994fcce775, 24 May. Thanks to Dave Kemper for the report. Fixes . Thanks to Stefan Möding for the new diagram! Fixes `-Wmissing-declarations` GCC warnings. [troff]: Refactor to kill off `ESCAPE_NEWLINE`. There appears to be no advantage to encoding escaped newlines in macro definitions. Its purpose cannot be to restore or pretty-print a macro definition exactly as it was input, as no mechanism for doing so exists, and comments are already discarded upon reading. [libgroff,troff]: Reallocate fatal error exit responsibilities, and communicate them to the compiler. [refer]: Add smoke test. [libgroff]: Disable unused `string` functions. [libgroff]: Trivially refactor. Rename `string` class's private member function `grow1()` to `embiggen()`. The former name is now potentially misleading because the internal function `srealloc()` now doubles a `string` object's capacity (`sz`) when exceeded. [libgroff]: Use a more appropriate return type for `string::find()`: `ssize_t` instead of `size_t`, since the function can return `-1`. Continues the long process of fixing Savannah #68192. It is not necessary to make conditional the deletion (or array deletion) of a null pointer. "If the _delete-expression_ calls the implementation deallocation function (3.7.3.2), and if the operand of the delete expression is not the null pointer constant, the deallocation function will deallocate the storage referenced by the pointer thus rendering the pointer invalid" {ISO/IEC 14882-1998, §5.3.5, paragraph 4}. Or as Stroustrup puts it, "Applying _delete_ to zero has no effect." (_The C++ Programming Language, Special Edition_, p. 128). [grohtml]: Be more fastidious with heap-allocated memory. Continues the long process of fixing Savannah #68192. [grohtml]: Fix code style nit. [grohtml]: Be more fastidious with heap-allocated memory. [pic]: Rationalize header file inclusions. Move some into "object.h" or "pic.h" where not doing so introduces cycles. Fixes . Resolves ASAN runtime error when formatting the groff_mdoc(7) man page in troff mode. Thanks to Bjarni Ingi Gislason for the report. [man]: Begin implementing new `LS` and `LE` macros. Begins fixing . Fixes . Thanks to Santiago Vila for the report and analysis. Problem introduced by me in commit 8910c63b6d, 2024-12-10. [troff]: Refactor. Separate engine logic from parsing logic with respect to an environment's temporary indentation. Correct some highly outdated Microsoft DOS/Windows port stuff. [grops]: Boolify and rename class member variable. (ps_output::put_fix_number): (ps_output::put_float): (ps_output::put_symbol): (ps_output::put_color): (ps_output::put_literal_symbol): Explicitly construct integer from its Boolean value when summing it with `col` and `end` to decide whether to put a newline on the output. Fixes . Problem introduced by me in commit d445aee94e, 10 September, as part of the redesign of the "asciify" feature. Thanks to Deri James for catching the problem and root-cause analyzing it. [troff]: Stop reporting number format for read-only registers. Fixes . Problem appears to date back to feature addition in commit bc34881980, 2007-09-19. [libgroff]: Decouple diagnosis of file I/O error from font description file content validation. [troff]: Trivially refactor. Rename `get_flags()` global function to `recompute_character_flags()`. In addition to being more clear and explicit, it avoids a collision with the `charinfo` class's own `get_flags()` member function. [troff]: Drop dead/unreachable nested character class code. [Fixes . Per the foregoing, problem dates back to groff 1.05, March 1992. Thanks to Dave and Deri for sorting this out! --GBR] [pdfmom]: Don't try to pass commands to pdfroff (-Tps) if pdfroff is not installed. See: Continues commit 0220f00c3c, 18 March. [troff]: Throw warning in category "style" when nilpotent brace escape sequences are encountered. Fixes . Problems appear mostly to date back to groff's birth: see groff 1.01,[1] "input/troff.cc", lines 741-746, 3113, and 3119. Commit 5ba4c4ddb3, 2001-11-16, added another instance of `read_character_in_copy_mode()` (then called `get_copy()`) being given only one argument. [1] https://minnie.tuhs.org/cgi-bin/utree.pl?file=Net2/usr/src/\ usr.bin/groff/troff/input.cc [groff]: Regression-test Savannah #68257. Time to fire up the development mailing list critical homunculus and have a Socratic dialogue with it. "Rewrite"? Why hit such a small thing with such a big hammer? Why not just fix my stupid mistake of adding an assertion? {A} I couldn't--wouldn't--just rip the assertion out, because it's in a hot-path function where much sanity checking takes place. {B} This code implicates one of the more challenging parts of the *roff language grammar: (almost) anywhere you can read a font identifier like `B`, `TR`, or `MARIGOLD`, it's also valid to read a font mounting position, a nonnegative integer. In *roff, nonnegative integers also happen to be valid identifier names! You can have a register named `55` or a string/macro/ diversion named `10` {hello, eqn(1)}. {C} This function is called only by uncommonly used request handlers, those for `uf`, `fschar`, `rfschar`, `special`, `fspecial`, `fzoom`, `bd`, and `tkf`. {It's a rare groff user who can say with confidence what _all_ of those requests do.} "But wait," you say, "isn't this same kind of font lookup done wildly commonly, like with every `ft` request or `\f` escape sequence? {D} Yes! So there's good news and bad news, and they're the same news. There is logic to do exactly that--to disambiguate and resolve font mounting positions and identifiers behind that request and that escape sequence. It lives, duplicatively, in another function in a different source file. {E} "But wait," you say, "why was this function, a supporting function for request handlers that read only space-delimited arguments, calling `token:: is_usable_as_delimiter()`?" Good question! I don't know, but it's been doing that, modulus the renamings for which I fear I am becoming notorious, at least since groff 1.22.3 in November 2014. Within the request handlers, we aren't in a delimited input context at all--as the GNU troff code base uses that term--so it's a mystery. `token::is_usable_as_delimiter()` used to be known as `token::delimiter()`. I invite the reader to compare and contrast the following. https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/\ troff/node.cpp?h=1.22.3#n6163 https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/troff/\ node.c?h=1.02#n4373 Why not just have `read_font_identifier()` call `select_font()` over in "env.cpp"? Side effects. As with many GNU troff functions, parsing logic is entangled with engine logic; see Savannah #68240. So instead I copy the lexical analysis bits of `select_font()` into this function, replacing most of it. How can I be confident this will work well? Apart from a build proceeding successfully and passing our test suite (now with 340 automated tests), the `select_font()` logic is a hotter code path and, I suspect, always has been. After my last push earlier this week, I gathered coverage statistics from a full build with tests. `read_font_identifier() was hit 12,023 times. That seems like a lot, right? `select_font()` was hit 254,489 times. If you can't successfully change fonts in GNU troff, a lot more people (and test scripts of ours) will notice than can observe malfunctions of the `uf`, `fschar`, `rfschar`, `special`, `fspecial`, `fzoom`, `bd`, or `tkf` requests. (And, in fact, `bd` _doesn't_ work well. See Savannah #68256.) So if I have to violate DRY, I'm cribbing the battle-hardened code. Moreover there's no reason at all, on any principle, to be checking for delimiters in this input context, as noted above. Fixes . The root cause of the problem depends on what you consider the defect to be. As noted above, the assertion came in with commit 8b83fd3dd8, 2 November, affecting groff 1.24.0. But the code path _containing_ the assertion should never have been taken in the first place by the request handlers for `bd` et al.--yet it has been, ever since groff's birth. Until now. Fixes . [groff]: Improve `dt` request unit test. We can consequently drop some now-unused code. (class page_length_reg): Drop `get_value()` declaration. (page_length_reg::get_value): Delete. (class vertical_position_reg): Drop `get_value()` declaration. (vertical_position_reg::get_value): Delete. (class high_water_mark_reg): Drop `get_value()` declaration. (high_water_mark_reg::get_value): Delete. (class distance_to_next_trap_reg): Drop `get_value()` declaration. (distance_to_next_trap_reg::get_value): Delete. [libgroff]: Trivially refactor. Rename library's `concat()` function to `catenate()`. [troff]: Trivially refactor for semantic clarity. The parameter named `required` used by many functions was employed for two slightly different purposes. In some instances, it indicated whether emission of a diagnostic message was desired in the event a token expected on the input stream (or similar) was absent. In others, it encoded whether the presence of such a token was _optional_, in which case both its presence and absence were valid. The latter tends to be the case when a token is present but might or might not have associated `charinfo` data. Detangle these issues by renaming `required` arguments to `want_diagnostic` and `is_mandatory` as appropriate. [build]: Drop no longer needed check for `struct exception`. It was used only by the now-deleted "src/libs/libgroff/matherr.c". [libgroff]: Drop "matherr.c" file, declaring (under the preprocessor conditions `HAVE_STRUCT_EXCEPTION` and `TLOSS`) `matherr()` and `struct exception`. The former is K&R-style, thus prohibited in ISO C23, and can (should) cause build failures with compilers configured for that version of the C language. Autoconf 2.73, released last month, tries harder to arrange builds to use C23 by default. Also we straight up don't _need_ this declaration (anymore); nothing in groff calls `matherr()`. It dates back to the Clark days, when there was no gnulib for groff to use (or maybe it didn't support C++ projects at the time). Whatever gnulib needs, it transitively closures for us, so we no longer need to and can throw this 30-year old stuff of ours away. Fixes . Problem appears to date back to groff's birth. Even the use of `int` is a bit slippery of us, since it's a signed type with a 31-bit significand. But libgroff's `glyph_to_unicode()`, which `get_unicode_code()` calls, uses "-1" to signal an error in-band. [troff]: Rename some member functions. [troff]: Refactor. Make the "guts" of the `chop_macro()` function a member function of class `macro`. [grotty]: Revise dynamic memory allocation strategy. The `tty_printer` class maintains a member variable `lines`, a pointer to a pointer to type `tty_glyph`, which it uses as a reference to a dynamically allocated rectangular array of character cells. The size of this array is not fixed; `pl` requests in an input document can grow or shrink the page length. The strategy it has used to date to handle a non-default page length proved to perform badly with the new approach to continuous rendering used by groff's man(7) and mdoc(7) packages in version 1.24.0. If the initial allocation of 66 lines (rows) of character cells was insufficient because the input extended the page length, it grew the allocation (and performed a memcpy(3) of its existing contents) by only as much as required to accommodate the current vertical drawing position, plus one line. For a famously lengthy man page like bash(1), this meant many repeated trips through new/memcpy()/delete sequences, giving the language runtime allocator a lot of work to do. In an extreme case {formatting 64 catenated copies of bash(1)}, this led to long runtimes with two-thirds of program time spent in the kernel. The new strategy is to double the allocation size every time it is exceeded, but also to free any resized allocation at the end of every page. When continuously rendering, there will only ever be one page anyway, but this tactic is more considerate for the {admittedly niche} case of paginated documents that vary the page length frequently--which is the approach that groff 1.23.0 and earlier took to continuous rendering, and that other macro packages or documents might still. (tbl(1) users should beware of the sort of problem observed in Savannah #65189.) This change reduces grotty(1)'s wall-clock time for the aforementioned 64 copies of bash(1) from 92.1 seconds to 3.5, and the proportion of process time spent in the system from 63.3% to 6.38%. [1] https://sourceware.org/git/?p=glibc.git;a=commit;\ h=46b5e98ef6f1 Fixes . Thanks to Dmytro Bagrii for the report, to Morten Bo Johansen for help reproducing the problem, and to Deri James for a shrewd pointer in the right direction. [troff]: Add internal mechanism for distinguishing validity of font mounting positions as _values_ from their usability to format output. A font mounting position is an integer with a limited range. The font information associated with that {otherwise valid} position can nevertheless not be usable for formatting output. While the formatter attempts to prevent input documents from contorting themselves into this situation, it also affords a means of egress from valid state. See the `sty` (counter-)example in groff's Texinfo manual . Add new function taking an integer mounting position and returning a Boolean. [troff]: Refactor resolution of currently selected font (which can be an abstract style, or even invalid) to a font mounting position. [troff]: Make warning diagnostic functions return `void`. Change return type of `warning()` and `output_warning()` functions from `int` to `void`. I would have boolified them, but nothing ever checks their return values. (do_expr_test): Rename local variable `saved_warning_mask` to `saved_desired_warnings`. (enable_warning, disable_warning): Rename local variable `mask` to `category`. (set_warning_mask_request): Rename this... (configure_desired_warnings_request): ...to this. (init_input_requests) : Update wire-uppery. (struct warning_category): Rename `mask` member to `set`. (lookup_warning): Track rename of structure member.