Debian Patches

Status for groff/1.22.4-10

Patch Description Author Forwarded Bugs Origin Last update
bash-scripts.patch The *2graph scripts use $RANDOM, which is bash-specific Colin Watson <> yes 2018-03-05
nroff-ifs.patch Unset IFS at nroff startup
It's questionable whether we should forward this; as noted in the bug
trail, there's a decent argument that this is a dash bug.
Colin Watson <> no debian 2018-03-05
doc-gfdl.patch Add GFDL references to manual pages licensed under GFDL Colin Watson <> not-needed debian 2018-11-30
doc-gzipped.patch Adjust documentation references to account for compression Colin Watson <> not-needed debian 2018-12-20
extratmacdirs.patch Allow adding a version-independent directory to the macro path
This allows us to put /usr/share/groff/tmac at the end of groff's macro
path in Debian.

This uses GNU-make-specific code, so it may not be forwardable in its
current state. A more upstreamable approach might be to add a --with-*
option to configure.
Colin Watson <> no 2018-03-05
papersize-config.patch Use /etc/papersize in preference to configure-time selection Colin Watson <> not-needed 2018-03-29
load-desc-failure.patch Display more helpful output when failing to load a device
If the device is known to be one of the devices in the groff binary package
rather than groff-base, refer the user to that.
Colin Watson <> not-needed 2018-03-05
mmse-note.patch Note that groff_mmse(7) is only available in Swedish locales Colin Watson <> no debian 2018-11-30
display-utc-times.patch Always use UTC times for display
Using localtime is problematic for reproducible builds. For now, always
use UTC times (gmtime etc.) for display. (Note that this changes the
semantics of \n[hours] etc., so may need further work.)
Colin Watson <> no 2018-03-05
sort-perl-hash-keys.patch Sort Perl hash keys
Hash iteration order may differ between runs, which makes builds harder
to reproduce. Sort hash keys in gropdf and afmtodit output to avoid
Colin Watson <> yes 2018-03-05
avoid-perl-diamond.patch Avoid Perl's unsafe "<>" operator
The "<>" operator is implemented using the two-argument form of "open",
which interprets magic such as pipe characters, allowing execution of
arbitrary commands which is unlikely to be expected. Perl >= 5.22 has a
"<<>>" operator which avoids this, but also forbids the use of "-" to
mean the standard input, which is a facility that the affected groff
programs document.

ARGV::readonly would probably also fix this, but I fundamentally dislike
the approach of escaping data in preparation for a language facility to
unescape it, especially when the required escaping is as non-obvious as
it is here. (For the same reason, I prefer to use subprocess invocation
facilities that allow passing the argument list as a list rather than as
a string to be interpreted by the shell.) So I've abandoned this
dubious convenience and changed the affected programs to iterate over
command-line arguments manually using the three-argument form of open.

This change involves an extra level of indentation, so it's a little
awkward to review. It consists of changing this form:

while (<>) { # or foreach, which is similar but less efficient

... into this:

unshift @ARGV, '-' unless @ARGV;
foreach my $filename (@ARGV) {
my $input;
if ($filename eq '-') {
$input = \*STDIN;
} elsif (not open $input, '<', $filename) {
warn $!;
while (<$input>) {

Local variations: glilypond doesn't need the initial unshift since
that's already handled in contrib/glilypond/; gropdf declares
$input in a slightly different way since it's also used in the LoadAhead
Colin Watson <> yes debian upstream 2019-02-28
mdoc-Lk-arguments.patch Correctly handle groff_mdoc(7) .Lk arguments starting with a dot.
* tmac/doc.tmac-u: Each argument to the .Lk macro is printed
on its own roff input line. If it happens to start with a dot
or apostroph, it was misinterpreted as a request or macro.
Force it to be treated as text by adding "\&" in front of it.

Bug reported by Jason McIntyre <jmc at OpenBSD>.
Ingo Schwarze <> no debian upstream, 2019-12-17
bsd-updates.patch Update NetBSD, OpenBSD, FreeBSD, Darwin, and DragonFly version strings.

* tmac/doc-common-u: Update.
* tmac/ Synchronize.

Based on a patch from Guillem Jover <>
via Colin Watson <>, tweaked by me.
Ingo Schwarze <> no debian upstream, 2019-12-23
document-sgr.patch Document Debian-specific man/mdoc SGR defaults Colin Watson <> not-needed debian 2020-06-25
destructor-segv.patch Fix SEGV arising from recursing destructor.
* src/roff/troff/node.h (output_file): Add class member `is_dying` to
track whether destructor has already been entered; initialize false.

* src/roff/troff/node.cpp (real_output_file::~real_output_file): Set
`is_dying` true when destructor entered.

* src/roff/troff/div.cpp (cleanup_and_exit): Only delete
`the_output` object if it is not already being destroyed.

Thanks to "hackerb9" for reporting the problem. Problem appears to date
back to groff 1.02 (June 1991) or earlier.

Fixes <>.
"G. Branden Robinson" <> yes upstream backport, 2021-09-09
clamp-negative-tab-stop-positions.patch [troff]: Clamp negative tab stop positions to 0.
...instead of throwing an assertion failure.

* src/roff/troff/env.cpp (tab_stops::distance_to_next_tab): Replace
`assert` with clamping logic, ensuring that `lastpos` can never be
negative. While negative tab stop positions don't make much sense
(they result in zero horizontal motion), user input like `.ta T -5`
should never provoke an assertion failure.

(set_tabs): Throw range warning in additional scenario, viz., if a
repeating tab offset is negative.

Fixes <>. Thanks to for the report.

Also wrap nearby long source lines.
"G. Branden Robinson" <> no debian backport, 2021-12-26
add-groff-1.23-forward-compatibility.patch tmac/{man.local,troffrc}: Add groff 1.23 fw compat "G. Branden Robinson" <> no 2023-03-04

All known versions for source package 'groff'