gbranden pushed a commit to branch master
in repository groff.
commit 49c7b6ce5acb56c36e607d71593b23273dc9635f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 16 12:37:49 2026 -0500
[troff]: Fix Savannah #68783.
* src/roff/troff/input.cpp (do_source): Throw warning in category
"missing" if either the `so` or `soquiet` request is not given an
argument. Deduce identity of calling request handler from value of
`quietly` argument, which while at present perfectly logically coupled
to that identity, leaves me uneasy. (But in the long term I hope to
turn `soquiet` into a macro anyway, which should be easy after
Savannah #68242 is fixed.)
Fixes <https://savannah.gnu.org/bugs/?68783>.
Before (since groff 1.24.0):
$ echo '.so \*a' | groff
groff: error: troff: Segmentation fault (core dumped)
$ echo '.soquiet \*a' | groff
groff: error: troff: Segmentation fault (core dumped)
Now:
$ echo '.so \*a' | ./build/test-groff -ww
troff:<standard input>:1: warning: name 'a' not defined [-w mac]
troff:<standard input>:1: warning: file sourcing request expects argument
[-w missing]
$ echo '.soquiet \*a' | ./build/test-groff -ww
troff:<standard input>:1: warning: name 'a' not defined [-w mac]
troff:<standard input>:1: warning: quiet file sourcing request expects
argument [-w missing]
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/input.cpp | 10 ++++++++++
2 files changed, 24 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 3a9af6556..4f1a518f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-10-16 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68783.
+
+ * src/roff/troff/input.cpp (do_source): Throw warning in
+ category "missing" if either the `so` or `soquiet` request is
+ not given an argument. Deduce identity of calling request
+ handler from value of `quietly` argument, which while at present
+ perfectly logically coupled to that identity, leaves me uneasy.
+ {But in the long term I hope to turn `soquiet` into a macro
+ anyway, which should be easy after Savannah #68242 is fixed.}
+
+ Fixes <https://savannah.gnu.org/bugs/?68783>.
+
2026-10-16 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68783.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1ffef9a92..af673591e 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7626,7 +7626,17 @@ static void while_continue_request() // .continue
static void do_source(bool quietly)
{
+ const char *rd = 0 /* nullptr */; // request description
+ if (quietly)
+ rd = "quiet file sourcing request";
+ else
+ rd = "file sourcing request";
char *filename = read_rest_of_line_as_argument();
+ if (0 /* nullptr */ == filename) {
+ warning(WARN_MISSING, "%1 expects argument", rd);
+ tok.next();
+ return;
+ }
errno = 0;
FILE *fp = include_search_path.open_file_cautiously(filename);
if (fp != 0 /* nullptr */)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit