gbranden pushed a commit to branch master
in repository groff.
commit f5c8144d61e6138cf6e7d47f4fe7f78ee0151046
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Aug 16 14:38:16 2026 -0500
[troff]: Fix Savannah #68616.
* src/roff/troff/input.cpp: Fix incorrect lexical analysis of
`stringdown` and `stringup` request arguments. Request handlers
themselves should call `skip_line()` after processing all arguments of
interest; this should not be done by "helper" functions if we can
avoid it. Failing to appropriately allocate responsibility in this
case led to excess request arguments being formatted as text instead
of ignored.
(do_string_case_transform): Stop calling `skip_line()` and
`tok.next()` here...
(stringdown_request, stringup_request): ...in favor of calling
`skip_line()` here.
Fixes <https://savannah.gnu.org/bugs/?68618>. Problem dates back to
introduction of these requests by me in commit 41d05cbfac, 2019-07-04.
Thanks to Ingo Schwarze for the report.
---
ChangeLog | 20 ++++++++++++++++++++
src/roff/troff/input.cpp | 8 +++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2b2bd198d..81eca8e19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2026-08-16 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68616.
+
+ * src/roff/troff/input.cpp: Fix incorrect lexical analysis of
+ `stringdown` and `stringup` request arguments. Request
+ handlers themselves should call `skip_line()` after processing
+ all arguments of interest; this should not be done by "helper"
+ functions if we can avoid it. Failing to appropriately allocate
+ responsibility in this case led to excess request arguments
+ being formatted as text instead of ignored.
+ (do_string_case_transform): Stop calling `skip_line()` and
+ `tok.next()` here...
+ (stringdown_request, stringup_request): ...in favor of calling
+ `skip_line()` here.
+
+ Fixes <https://savannah.gnu.org/bugs/?68618>. Problem dates
+ back to introduction of these requests by me in commit
+ 41d05cbfac, 2019-07-04. Thanks to Ingo Schwarze for the report.
+
2026-08-16 G. Branden Robinson <[email protected]>
[troff]: Regression-test Savannah #68618.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index c9e6be2ac..a0ed96901 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5870,16 +5870,13 @@ static void do_string_case_transform(case_xform_mode
mode)
assert((STRING_DOWNCASE == mode) || (STRING_UPCASE == mode));
symbol s = read_identifier();
assert(s != 0 /* nullptr */);
- if (s.is_null()) {
- skip_line();
+ if (s.is_null())
return;
- }
request_or_macro *p = lookup_request(s);
macro *m = p->to_macro();
if (0 /* nullptr */ == m) {
error("cannot apply string case transformation to request '%1'",
s.contents());
- skip_line();
return;
}
string_iterator iter1(*m);
@@ -5901,7 +5898,6 @@ static void do_string_case_transform(case_xform_mode mode)
mac->append(nc);
}
request_dictionary.define(s, mac);
- tok.next();
}
// Transform each byte of the string argument's contents to lowercase.
@@ -5914,6 +5910,7 @@ static void stringdown_request() // .stringdown
return;
}
do_string_case_transform(STRING_DOWNCASE);
+ skip_line();
}
// Transform each byte of the string argument's contents to uppercase.
@@ -5926,6 +5923,7 @@ static void stringup_request() // .stringup
return;
}
do_string_case_transform(STRING_UPCASE);
+ skip_line();
}
static void substring_request() // .substring
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit