0

I'm using a Wyse50 Terminal emulation on Rocky Linux 9. Man pages, help screens, etc., are unusable because the system outputs attribute and color codes that the terminal emulator doesn't understand; so, for example, man cp reads like this:

1mSYNOPSIS0mm
       1mcp 22m[4mOPTION24m]... [4m-T24m] 4mSOURCE24m 4mDEST0mm
       1mcp 22m[4mOPTION24m]... 4mSOURCE24m... 4mDIRECTORY0mm
       1mcp 22m[4mOPTION24m]... 4m-t24m 4mDIRECTORY24m 4mSOURCE24m...m  m

1mDESCRIPTION0mm

I've updated the latest terminfo packages and did an infocmp between the latest wy50 and the wy50 from a Linux 4 where everything worked fine.

I see nothing in profile, bash_profile, bashrc or .bashrc that would set any color parameters.

What am I missing? (other than a legacy application that belongs in the prior century)

  • 2
    What is `$TERM` set to? – Stephen Kitt Dec 20 '22 at 18:34
  • wy50;wyse50;wy50-25;wy60;wy60-25 -- tried them all – Darrel Barton Dec 20 '22 at 21:37
  • I suggest editing the summary text of your question. Please prefix the word "Rocky" to "Linux 9" since "Linux 9" will have either no or a confusing meaning to many SE contributors. Next, none of the escape sequences are "color"; the ones you quoted, in technical terms, selected graphic renditions involving boldface or underline attributes. These sequences are standardized in ISO 6429 (a gratis version is available in ECMA-48). Nevertheless many people call these ANSI escape sequences in vague reference to ANSI X3.64, which (I think) was withdrawn in favor of the international standards. – TheNotoriousGBR Dec 22 '22 at 01:16
  • What are you using as a Wyse 50 terminal emulator? Is it Free Software? I'm tempted to try this myself. – TheNotoriousGBR Dec 22 '22 at 23:45

3 Answers3

1

That's groff's hard-coded default behavior (ncurses and terminfo are not involved). It's a misfeature introduced in February 2002 (see Debian #257413). As a workaround, you can set the environment variable GROFF_NO_SGR to some non-empty value.

Almost all (none that you're likely to encounter) video terminals do what is expected with a sequence of character, backspace, overstrike (over underscore or the same character). This is sometimes mis-characterized as ASR 33, though that is not a video terminal, but a printer (I've used both, of course).

Further reading:

Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/142053/discussion-on-answer-by-thomas-dickey-linux-9-commands-send-ansi-color-sequences). – terdon Jan 14 '23 at 15:17
1

I object to Thomas Dickey's characterization of this behavior as a misfeature.

I have laid out my reasons thoroughly elsewhere.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312935

The short version is that neither the Wyse 50 nor modern terminal emulators nor *ix kernel console devices are emulators of Teletype machines.

For groff 1.24, I would like to make grotty a terminfo application so that it can more intelligently adapt to terminal capabilities.

Even once it does that, however, it will not reliably mimic a Teletype Corporation Model 37, because most terminal emulators in use today cannot do so.

In the meantime you can set the GROFF_NO_SGR environment variable.

  • That export still leaves a lowercase "m" at the end of every line and at the beginning of every blank line. – Darrel Barton Dec 21 '22 at 21:36
  • That sounds like an error in your terminal description. While "m" is used to end SGR escape sequences--see [ECMA-48](https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf) or the [xterm ctlseqs.ms document](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html) that Thomas Dickey maintains. Now that you mention it, I see an _extra_ m at the end of every line. Try the command `tput cr | od -c`. – TheNotoriousGBR Dec 22 '22 at 00:52
  • ?2004h[root@serv w]# tput cr | od -c 0000000 \r 0000001 ?2004h[root@serv w]# – Darrel Barton Dec 22 '22 at 16:51
  • Darrel, thanks. I don't see anything wrong with that value for the `cr` capability. Please try `echo | nroff | od -c`. – TheNotoriousGBR Dec 22 '22 at 22:02
0

In general in a Linux distro or other Unix system, when using a serial port or equivalent pseudo-terminal (such as in an ssh or telnet session), individual programs' output goes directly to the terminal as-is -- there isn't any kind of translation layer for terminal formatting escape sequences in the Linux kernel or anywhere else.

Many programs will try to produce appropriate output for the terminal you're using, as determined from the TERM environment variable setting, themselves, often with the help of libraries such as terminfo and termcap and the like, but those that don't don't -- if you run something that doesn't, and it expects a terminal type you don't have and outputs inappropriate escape sequences, your terminal will receive inappropriate escape sequences.

rakslice
  • 1,147
  • 2
  • 11
  • 17