[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 08/09: [troff]: Fix Savannah #66526 (`|` handling).
From: |
G. Branden Robinson |
Subject: |
[groff] 08/09: [troff]: Fix Savannah #66526 (`|` handling). |
Date: |
Wed, 4 Dec 2024 09:51:23 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit ea1e00de47b376560267b9e1390ee2613fdedccf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Dec 4 04:31:34 2024 -0600
[troff]: Fix Savannah #66526 (`|` handling).
* src/roff/troff/input.cpp (is_conditional_expression_true): Stop
treating `|` as a delimiter, but instead as beginning a numeric
expression, _only_ as the predicate of a control structure request.
Improves compatibility with AT&T troff, including DWB 3.3 and Heirloom
Doctools. Problem appears to date back to groff 1.02.
GNU troff has long thrown diagnostics in this context, of increasing
detail in recent years. For example:
troff:mm/0.MT:271: warning: missing closing delimiter in output
comparison operator; expected character '|', got a newline
However, this was easily overlooked in our automated tests because it
didn't break formatting, except on Solaris 10 (or if you ran the
post-1.23.0 test "contrib/mm/tests/memoranda-format-correctly.sh"
with an older groff release).
Fixes <https://savannah.gnu.org/bugs/?66526>.
---
ChangeLog | 22 ++++++++++++++++++++++
src/roff/troff/input.cpp | 4 +++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 7e8c31203..573f25c8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2024-12-04 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/input.cpp (is_conditional_expression_true):
+ Stop treating `|` as a delimiter, but instead as beginning a
+ numeric expression, _only_ as the predicate of a control
+ structure request. Improves compatibility with AT&T troff,
+ including DWB 3.3 and Heirloom Doctools. Problem appears to
+ date back to groff 1.02.
+
+ GNU troff has long thrown diagnostics in this context, of
+ increasing detail in recent years. For example:
+
+ troff:mm/0.MT:271: warning: missing closing delimiter in output
+ comparison operator; expected character '|', got a newline
+
+ However, this was easily overlooked in our automated tests
+ because it didn't break formatting, except on Solaris 10 (or if
+ you ran the post-1.23.0 test "contrib/mm/tests/
+ memoranda-format-correctly.sh" with an older groff release).
+
+ Fixes <https://savannah.gnu.org/bugs/?66526>.
+
2024-12-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2be0b1e0a..09d4dd6a7 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6415,7 +6415,9 @@ static bool is_conditional_expression_true()
}
else if (tok.is_space())
result = false;
- else if (tok.is_usable_as_delimiter()) {
+ // Treat `|` specially for AT&T troff compatibility, where it _isn't_
+ // a delimiter in this context; see Savannah #66526.
+ else if (tok.is_usable_as_delimiter() && (tok.ch() != '|')) {
// Perform (formatted) output comparison.
token delim = tok;
int delim_level = input_stack::get_level();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 08/09: [troff]: Fix Savannah #66526 (`|` handling).,
G. Branden Robinson <=