gbranden pushed a commit to branch master
in repository groff.
commit 591b495132a3c759b4cb1c6e0a4a23bec40dab2f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 16 12:57:46 2026 -0500
[troff]: Fix Savannah #68784.
* src/roff/troff/input.cpp (do_macro_source): Throw warning in category
"missing" if either the `mso` or `msoquiet` 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 `msoquiet` into a macro anyway, which should be easy after
Savannah #68242 is fixed.)
Fixes <https://savannah.gnu.org/bugs/?68784>.
Before:
$ echo '.mso \*a' | groff
troff: ../src/libs/libgroff/searchpath.cpp:118: FILE*
search_path::open_file(const char*, char**): Assertion `name != 0' failed.
groff: error: troff: Aborted (core dumped)
$ echo '.msoquiet \*a' | groff
troff: ../src/libs/libgroff/searchpath.cpp:118: FILE*
search_path::open_file(const char*, char**): Assertion `name != 0' failed.
groff: error: troff: Aborted (core dumped)
After:
$ echo '.mso \*a' | ./build/test-groff -ww
troff:<standard input>:1: warning: name 'a' not defined [-w mac]
troff:<standard input>:1: warning: macro file sourcing request expects
argument [-w missing]
$ echo '.msoquiet \*a' | ./build/test-groff -ww
troff:<standard input>:1: warning: name 'a' not defined [-w mac]
troff:<standard input>:1: warning: quiet macro 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 c49d59f6c..2610a90c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-10-16 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68784.
+
+ * src/roff/troff/input.cpp (do_macro_source): Throw warning in
+ category "missing" if either the `mso` or `msoquiet` 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 `msoquiet` into a macro
+ anyway, which should be easy after Savannah #68242 is fixed.}
+
+ Fixes <https://savannah.gnu.org/bugs/?68784>.
+
2026-10-16 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68784.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 0ed74edc9..c82a9ac35 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -9922,7 +9922,17 @@ static void process_startup_file(const char *filename)
static void do_macro_source(bool quietly)
{
+ const char *rd = 0 /* nullptr */; // request description
+ if (quietly)
+ rd = "quiet macro file sourcing request";
+ else
+ rd = "macro file sourcing request";
char *macro_filename = read_rest_of_line_as_argument();
+ if (0 /* nullptr */ == macro_filename) {
+ warning(WARN_MISSING, "%1 expects argument", rd);
+ tok.next();
+ return;
+ }
char *path;
FILE *fp = mac_path->open_file(macro_filename, &path);
if (fp != 0 /* nullptr */) {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit