URL:
<https://savannah.gnu.org/bugs/?65469>
Summary: [man] poor choice of escape character in
`an*scan-string-for-backslash`
Group: GNU roff
Submitter: gbranden
Submitted: Sun 17 Mar 2024 01:25:03 AM UTC
Category: Macro man
Severity: 2 - Minor
Item Group: Warning/Suspicious behaviour
Status: In Progress
Privacy: Public
Assigned to: gbranden
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Sun 17 Mar 2024 01:25:03 AM UTC By: G. Branden Robinson <gbranden>
[https://lists.gnu.org/archive/html/bug-ncurses/2024-03/msg00063.html Noted by
Thomas Dickey on the bug-ncurses@gnu list].
$ sed -n 31p ./man/tic.1m
.TH @TIC@ 1M 2023-12-30 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User
commands"
$ ~/groff-stable/bin/nroff -ww -mandoc ./man/tic.1m | tail -n 1
troff:./man/tic.1m:31: warning: missing closing delimiter in output comparison
operator (got a newline)
troff:./man/tic.1m:31: warning: missing closing delimiter in output comparison
operator (got a newline)
troff:./man/tic.1m:31: warning: missing closing delimiter in output comparison
operator (got a newline)
troff:./man/tic.1m:31: warning: missing closing delimiter in output comparison
operator (got a newline)
ncurses @NCURSES_MAJOR@.@NCURS... 2023‐12‐30
@TIC@(1M)
The good news is that the macro and its parent (`an*abbreviate-inner-footer`)
still work as intended, at least for this input. I haven't reasoned out
carefully if they will for _any_ input containing `@` characters.
The unfortunate bit is of course the spurious diagnostic messages. They
aren't the user's fault and we shouldn't be throwing them.
My choice of `@` for the alternate escape character was poor.
Until we get a string iterator (bug #62264), and then can write things like
_index_(3) or _strchr_(3) in *roff, I don't think there is a good solution for
this. Any character that is valid in a man page footer is a valid escape
character. (In fact, the latter is a subset of the former.)
But, in the meantime, I can pick a valid escape character that is unlikely to
be used by any sane person for _sed_(1) substitutions in man page text.
...the delete character, U+007F. I've tested this and it works.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index fab6fdd64..3cfdc2a84 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -537,9 +537,9 @@ .de an*scan-string-for-backslash
. while (\\n[an*index] < \\n[an*max-index]) \{\
. ds an*char \\$*
. substring an*char \\n[an*index] \\n[an*index]
-. ec @
+. ec ^?
. \" Use a weird delimiter to reduce lexical colorizer confusion.
-. if _@*[an*char]_\\_ .nr an*string-contains-backslash 1
+. if _^?*[an*char]_\\_ .nr an*string-contains-backslash 1
. ec
. if \\n[an*string-contains-backslash] .break
. nr an*index +1
$ ./build/test-groff -ww -mandoc -Tutf8 ../ncurses-snapshots/man/tic.1m | tail
-n 1
ncurses @NCURSES_MAJOR@.@NCURSE... 2023‐12‐30
@TIC@(1M)
So that's what I'll do.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65469>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/