Skip to content

Commit

Permalink
test/system: Unbreak the manual page checks with GNU roff >= 1.23
Browse files Browse the repository at this point in the history
GNU roff 1.23 stopped remapping unescaped Hyphen-Minus (ie., - or 0x2D)
characters in the input to Hyphen-Minus in the output.  Instead, it
follows the specified behaviour of converting unescaped Hyphen-Minus
characters in the input to Hyphen (ie., ‐ or 0x2010) in the output.  To
get Hyphen-Minus characters in the output, one needs to escape the
Hyphen-Minus with a backslash (ie., \-) in the input [1].

Therefore, the command line options documented in the manuals are no
longer prefixed with the Hyphen-Minus character that's needed to
ctually use them.  This breaks copying and pasting from the manuals and
searching within them.

Unfortunately, escaping the Hyphen-Minus characters in Markdown doesn't
have the intended effect of having Hyphen-Minus in the generated manual
pages [2].  Therefore, this is worked around by having the tests check
for both Hyphen-Minus and Hyphen.

Note that some operating system distributions, like Debian, have
reverted this change from GNU roff, but others haven't.  So, unless it
can be guaranteed that the manuals will always have Hyphen-Minus
regardless of which GNU roff version or variant is being used, the tests
need to check for both.

[1] https://lwn.net/Articles/947941/
    https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00001.html
    https://git.savannah.gnu.org/cgit/groff.git/tree/PROBLEMS?h=1.23.0#n82

[2] cpuguy83/go-md2man#101

#1398
  • Loading branch information
debarshiray committed Nov 2, 2023
1 parent 651995e commit f28ad77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/system/002-help.bats
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ setup() {
assert_success
assert_line --index 0 --partial "toolbox(1)"
assert_line --index 0 --partial "General Commands Manual"
assert_line --index 3 --partial "toolbox - Tool for containerized command line environments on Linux"
assert_line --index 3 --regexp "^[[:blank:]]+toolbox [‐-] Tool for containerized command line environments on Linux$"
assert [ ${#lines[@]} -gt 4 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
Expand Down Expand Up @@ -80,7 +80,7 @@ setup() {
assert_success
assert_line --index 0 --partial "toolbox(1)"
assert_line --index 0 --partial "General Commands Manual"
assert_line --index 3 --partial "toolbox - Tool for containerized command line environments on Linux"
assert_line --index 3 --regexp "^[[:blank:]]+toolbox [‐-] Tool for containerized command line environments on Linux$"
assert [ ${#lines[@]} -gt 4 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
Expand Down

0 comments on commit f28ad77

Please sign in to comment.