gbranden pushed a commit to branch master
in repository groff.
commit 887f6f368e3900471b364b730a33f9594eb488ee
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 27 01:07:33 2026 -0500
[doc,man]: Note prev font sel portability hazard.
Thanks to Russ Allbery for bringing this footgun to my attention back in
2022[1] and Karl Berry for underscoring its continued importance.[2]
[1] https://lists.gnu.org/archive/html/groff/2022-11/msg00162.html
[2] https://lists.gnu.org/archive/html/groff/2026-04/msg00038.html
ANNOUNCE: Acknowledge Russ.
---
ANNOUNCE | 1 +
doc/groff.texi.in | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
man/groff_diff.7.man | 32 ++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
diff --git a/ANNOUNCE b/ANNOUNCE
index 67a29255a..0d2ddf821 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -219,4 +219,5 @@ Johannes Altmanninger
Karl Berry
Morten Bo Johansen
Richard Purdie
+Russ Allbery
Zack Weinberg
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index c32ccfa64..093133415 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -23004,6 +23004,55 @@ spaces or tabs between the ordinary control character
and a
or macro name that would normally end a macro definition
prevent it from doing so.
+GNU
+@command{troff} @c GNU
+regards a failed attempt to select a different font
+as a meaningful action
+and updates the the identity of the previous font selection.
+Most @acronym{AT&T}-descended
+@command{troff}s @c AT&T
+do not.
+Consequently,
+given the input
+
+@Example
+\fBfoo\fZbar\fPbaz
+@endExample
+
+and,
+assuming that the output device lacks a font named
+@samp{Z},
+GNU
+and Heirloom Doctools
+@command{troff}s @c GNU, Heirloom
+set
+@samp{baz}
+in bold;
+DWB,
+Plan@tie{}9,
+and Solaris@tie{}10
+@command{troff}s @c DWB, Plan 9, Solaris 10
+set it in roman.
+The only way to determine if a font selection operation succeeded
+in the latter group of formatters
+is to save the value of the
+@code{.f}
+register prior to attempting the change,
+make the attempt,
+then compare the saved value to the current one;
+if it changed,
+the font selection presumably succeeded.
+Since doing so requires
+@code{nr}
+and
+@code{if}
+(or
+@code{ie})
+requests,
+such a procedure cannot be performed amid
+@code{\f}
+sequences on an input line.
+
Formatters that don't implement
GNU
@command{troff} @c GNU
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index dc3d54e91..fa4a218be 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -6769,6 +6769,38 @@ prevent it from doing so.
.
.
.P
+GNU
+.I troff \" GNU
+regards a failed attempt to select a different font
+as a meaningful action
+and updates the the identity of the previous font selection.
+Most AT&T-descended
+.IR troff s \" AT&T
+do not.
+.
+The only way to determine if a font selection operation succeeded
+in the latter group of formatters
+is to save the value of the
+.B .f
+register prior to attempting the change,
+make the attempt,
+then compare the saved value to the current one;
+if it changed,
+the font selection presumably succeeded.
+.
+Since doing so requires
+.B nr
+and
+.RB \[lq] if \^\[rq]
+(or
+.BR ie )
+requests,
+such a procedure cannot be performed amid
+.B \[rs]f
+sequences on an input line.
+.
+.
+.P
Formatters that don't implement
GNU
.I troff \" GNU
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit