#1052264 dash: Fix manpage dashes (ASCII '-' / hyphen / en dash / em dash)

Package:
dash
Source:
dash
Description:
POSIX-compliant shell
Submitter:
Peter Samuelson
Date:
2023-09-19 17:39:04 UTC
Severity:
normal
Tags:
#1052264#5
Date:
2023-09-19 17:37:00 UTC
From:
To:
tl;dr: This patch restores the ability to search manpages for text
containing ASCII hyphens, like "-V" or ">&-", using pagers like "less".

nroff can render 4 distinct dash characters, if non-ASCII output is
supported (as in modern Debian, unless suppressed with, e.g.,
"export MANOPT=-Eascii"):

\-      ASCII hyphen.
        Use: Any place one would type a literal ASCII hyphen:
        "ls \-F", "$((OPTIND \- 1))", "chdir \-"

-       non-ASCII hyphen
        Use: Phrases like "POSIX-compliant", "human-readable", "built-in".
        Also used by nroff to break a word of text across 2 lines.

\(en    en dash (the width of "n").
        Use: Very rare. I think it's a mathematical minus sign, but of
        course it's not used in $(( )) shell expressions.

\(em    em dash (traditionally, the width of lowercase "m").
        Use: To break up grammatical phrases: "the shell executes the
        command asynchronously \(em that is, the shell does not wait for
        the command to finish"

The - vs. \- distinction especially matters, because if you search for
"<<-" by typing "/<<-" into "less", but nroff has used a non-ASCII
hyphen there, it will not find it.

(Also, some older X11 fonts don't have the non-ASCII dash chars. Though
that has an easy workaround, "MANOPT=-Eascii".)

Thanks,
Peter