URL: <https://savannah.gnu.org/bugs/?68825>
Summary: [tbl] issues extraneous, spurious warning regarding
comment escape sequence in table entry
Group: GNU roff
Submitter: gbranden
Submitted: Fri 23 Oct 2026 08:04:28 PM UTC
Category: Preprocessor tbl
Severity: 3 - Normal
Item Group: Warning/Suspicious behaviour
Status: In Progress
Privacy: Public
Assigned to: gbranden
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 23 Oct 2026 08:04:28 PM UTC By: G. Branden Robinson <gbranden>
We get an expected and desired warning, but also an extra and incorrect one,
since _groff_ 1.24.0.
$ ~/groff-1.24.0/bin/nroff -t ATTIC/tbl_comment.roff
tbl:ATTIC/tbl_comment.roff:3: warning: comment escape sequence '\"' in entry
"foo\" bar"
tbl:ATTIC/tbl_comment.roff:3: warning: comment escape sequence '\#' in entry
"foo\" bar"
ATTIC/tbl_comment.roff:3: warning: table wider than line length minus
indentation
foo
## 2026-10-23 14:55:51 bash-5.2 [6] {0} (0) branden@illithid:~/src/GIT/groff
!969$ cat ATTIC/tbl_comment.roff
.TS
L.
foo\" bar
.TE
.pl \n[nl]u
$ ~/groff-1.24.0/bin/nroff -t ATTIC/tbl_comment.roff
tbl:ATTIC/tbl_comment.roff:3: warning: comment escape sequence '\"' in entry
"foo\" bar"
tbl:ATTIC/tbl_comment.roff:3: warning: comment escape sequence '\#' in entry
"foo\" bar"
ATTIC/tbl_comment.roff:3: warning: table wider than line length minus
indentation
foo
(The final warning is an expected consequence of the entry width computation
being ruined by the comment escape sequence. This is why we warn about
comment escape sequences in the first place.)
This misbehavior is due to a logic error I introduced in commit 207723e5bf,
2024-10-06, while fixing a SEGV.
Here's a fix.
commit 13c80879b64ecac8d0def372a94af98ef8f5ab2c (HEAD -> master)
Author: G. Branden Robinson <[email protected]>
Date: Fri Oct 23 15:00:02 2026 -0500
XXX fix excess tbl warning
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 5ed057025..633c6de60 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1558,15 +1558,15 @@ void table::add_entry(int r, int c, const string
&str,
}
int gcommentpos = str.find("\\#");
// If both types of comment are present, the first is what matters.
- if ((gcommentpos != -1) && (gcommentpos < commentpos))
- commentpos = gcommentpos;
- if (commentpos != -1) {
+ if (gcommentpos != -1) {
int controlpos = str.search('.');
if ((-1 == str.search('\n')) // not a text block, AND
&& ((-1 == controlpos) // (no control character in line OR
|| (0 == controlpos))) // control character at line start)
warning_with_file_and_line(fn, ln, "comment escape sequence"
" '\\#' in entry \"%1\"", s);
+ if (gcommentpos < commentpos)
+ commentpos = gcommentpos;
}
// A \! escape sequence after a comment has started is okay.
int exclpos = str.find("\\!");
Result:
$ ./build/test-groff -t -T utf8 ATTIC/tbl_comment.roff
tbl:ATTIC/tbl_comment.roff:3: warning: comment escape sequence '\"' in entry
"foo\" bar"
troff:ATTIC/tbl_comment.roff:3: warning: missing closing delimiter in width
computation escape sequence; expected special character or class 'tbl', got a
newline [-w delim]
ATTIC/tbl_comment.roff:3: warning: table wider than line length minus
indentation
foo
Yes, that's still 3 different diagnostic messages for one mistake, but comment
escape sequences in table entries cause cascading problems, as shown. Without
the first of these messages, the user is likely to be left no wiser regarding
what's wrong with their table.
The other reason we see 3 warnings in pre-1.25.0 is that the "delim" warning
category is now enabled by default.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68825>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
