gbranden pushed a commit to branch master
in repository groff.
commit ab462a20e93017c8e656741f7fcc4590e925535b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu May 28 15:44:10 2026 -0500
[troff]: Fix Savannah #68357.
* src/roff/troff/div.cpp (when_request, diversion_trap_request):
Enforce space requirement between first and second arguments to `wh`
and `dt` requests.
* doc/groff.texi.in (Other Differences):
* man/groff_diff.7.man (Other differences):
* NEWS: Document this behavioral difference from AT&T troffs.
Fixes <https://savannah.gnu.org/bugs/?68357>. Problem appers to date
back to groff's birth.
---
ChangeLog | 13 +++++++++++++
NEWS | 8 ++++++++
doc/groff.texi.in | 20 ++++++++++++++++++++
man/groff_diff.7.man | 22 ++++++++++++++++++++++
src/roff/troff/div.cpp | 31 +++++++++++++++----------------
5 files changed, 78 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 305c4d473..6e20be7a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2026-05-28 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/div.cpp (when_request, diversion_trap_request):
+ Enforce space requirement between first and second arguments to
+ `wh` and `dt` requests.
+
+ * doc/groff.texi.in (Other Differences):
+ * man/groff_diff.7.man (Other differences):
+ * NEWS: Document this behavioral difference from AT&T troffs.
+
+ Fixes <https://savannah.gnu.org/bugs/?68357>. Problem appers to
+ date back to groff's birth.
+
2026-05-28 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68357.
diff --git a/NEWS b/NEWS
index ffd956b15..b6daef441 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,14 @@ troff
process a list of similar objects, as `rm` and `rr` do) perform no
operation.
+* The `dt` and `wh` requests now enforce their requirement of space
+ between their arguments. While consistent with GNU troff input
+ syntax, it is not consistent with AT&T troff. We did not add support
+ in groff's AT&T troff compatibility mode because we're aware of no
+ legacy documents that require it. Example: `.wh9i+.5+\n(xxuPT` is,
+ while validly planting a trap for the `PT` macro in AT&T troff,
+ an input considerably more cryptic than any specimens known to us.
+
* The formatter now enables the "delim", "syntax", and "escape" warning
categories by default.
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 9d03bc0a6..bf2a95276 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -24092,6 +24092,26 @@ and
@samp{.ps 10z}
are portable.
+@cindex @code{dt} request, incompatibilities with @acronym{AT&T} @code{troff}
+@cindex @code{wh} request, incompatibilities with @acronym{AT&T} @code{troff}
+@acronym{AT&T}
+@command{troff}s @c AT&T
+did not require a space between the arguments of the
+@code{dt}
+and
+@code{wh}
+requests.
+We know of no legacy documents that require such syntactical
+flexibility;
+GNU
+@command{troff} @c GNU
+therefore does not support it.
+It may have been unknown because the numeric expression accepted
+by the requests could be of arbitrary length.
+@c Example: .wh9i+.5+\n(xxuPT
+@c See Savannah #68375 for historical exhibits of actual usage, all of
+@c which separate the arguments with a space.
+
@cindex @code{ab} request, incompatibilities with @acronym{AT&T} @code{troff}
The
@code{ab}
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 51a4dd6f9..e78372aae 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -7125,6 +7125,28 @@ are portable.
.
.
.P
+AT&T
+.IR troff s \" AT&T
+did not require a space between the arguments of the
+.B dt
+and
+.B wh
+requests.
+.
+We know of no legacy documents that require such syntactical
+flexibility;
+GNU
+.I troff \" GNU
+therefore does not support it.
+.
+It may have been unknown because the numeric expression accepted
+by the requests could be of arbitrary length.
+.\" Example: .wh9i+.5+\n(xxuPT
+.\" See Savannah #68375 for historical exhibits of actual usage, all of
+.\" which separate the arguments with a space.
+.
+.
+.P
The
.B ab
request differs from that of AT&T
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index b8eed09cf..32e8b2d29 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -779,19 +779,19 @@ static void configure_page_length_request() // .pl
static void when_request() // .wh
{
- vunits n;
- if (has_arg()) {
- if (read_vunits(&n, 'v')) {
- symbol s = read_identifier();
- if (s.is_null())
- topdiv->remove_trap_at(n);
- else
- topdiv->add_trap(s, n);
- }
- }
- else
+ if (!has_arg()) {
warning(WARN_MISSING, "page trap location configuration request"
" expects arguments");
+ skip_line();
+ return;
+ }
+ vunits n;
+ if (read_vunits(&n, 'v')) {
+ if (!has_arg())
+ topdiv->remove_trap_at(n);
+ else
+ topdiv->add_trap(read_identifier(), n);
+ }
skip_line();
}
@@ -1012,11 +1012,10 @@ static void diversion_trap_request() // .dt
if (!has_arg())
curdiv->clear_diversion_trap();
else if (read_vunits(&n, 'v')) {
- symbol s = read_identifier();
- if (s.is_null())
- curdiv->clear_diversion_trap();
- else
- curdiv->set_diversion_trap(s, n);
+ if (!has_arg())
+ curdiv->clear_diversion_trap();
+ else
+ curdiv->set_diversion_trap(read_identifier(), n);
}
// We have no `else` branch here; `read_vunits()` may have already
// thrown an error diagnostic. ("May have"? See Savannah #68375.)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit