bugGNU Screen - Bugs: bug #50601, Screen rewrites 38;5;nn escapes...


bug #50601: Screen rewrites 38;5;nn escapes even when surrounding terminal supports them

Submitted by:  Peder Stray <pstray>
Submitted on:  Tue 21 Mar 2017 01:30:39 PM UTC  
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: OpenRelease: 4.5.0
Fixed Release: NonePlanned Release: 5.0.0
Work Required: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 09 Jul 2017 09:57:47 PM UTC, comment #5:

Fixed on master branch in:


Amadeusz Sławiński <amade>
Project Administrator
Wed 22 Mar 2017 05:05:54 PM UTC, comment #4:

Just to see what screen does, I straced it. Seems it maps both back and foreground of 38;5;nn and 48;5;nn into 30/40 and 90/100 for 0 to 15. Attached a new file that shows what the test program outputs, what screen reads in, and what screen writes out.

(file #40065)

Peder Stray <pstray>
Wed 22 Mar 2017 01:50:08 PM UTC, comment #3:

Thanks, confirmed.

Amadeusz Sławiński <amade>
Project Administrator
Wed 22 Mar 2017 01:14:54 PM UTC, comment #2:

TERM is xterm-256color in both gnome-terminal (3.18.3) and xterm (322). In screen (4.03.01) on my local host TERM=screen.xterm-256color, in screen (4.05.01) on my remote TERM=screen-bce.

infocmp output for all of them will are attached.

I've also attached a test script that should display the error when present, the line prefixed with "1;38+0" should be the same as the one above it, not alternating in intensity.

(file #40057, file #40058, file #40059, file #40060)

Peder Stray <pstray>
Wed 22 Mar 2017 08:53:51 AM UTC, comment #1:

I can't reproduce, please provide more details:
gnome-terminal version
screen version
output of
"echo $TERM" and "echo $COLORTERM"
inside and outside of screen
script used to test color codes.

Amadeusz Sławiński <amade>
Project Administrator
Tue 21 Mar 2017 01:30:39 PM UTC, original submission:

Even though the surrounding terminal supports 256-colors and thus 38;5;nn escapes, screen seem to rewrite those sequences for at least colors 0 through 7 to 30+nn instead. This causes color errors when combing whith bold (1) as 30+nn together with bold usually maps to colors nn+8, and thus any of the first 8 colors is then displayed as bright intensity in addition to bold.

See the two supplied images, the first showing how gnome-terminal displays the colors (and how they should be), the second how the same output in screen causes translation of escape codes an thus the display of wrong colors.

The same happens with xterm as the surrounding terminal.

Peder Stray <pstray>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #40065:  screen-output.txt added by pstray (5KiB - text/plain)
file #40059:  infocmp-screen-bce.txt added by pstray (2KiB - text/plain)
file #40060:  term-test.pl added by pstray (963B - application/x-perl)
file #40045:  terminal-noerror.png added by pstray (27KiB - image/png)
file #40046:  screen-error.png added by pstray (27KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by amade (Posted a comment)
  • -unavailable- added by pstray (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 09 Jul 2017 09:57:47 PM UTCamadeStatusConfirmed=>Fixed
      Planned ReleaseNone=>5.0.0
    Wed 22 Mar 2017 05:05:54 PM UTCpstrayAttached File-=>Added screen-output.txt, #40065
    Wed 22 Mar 2017 01:50:08 PM UTCamadeStatusNeed Info=>Confirmed
    Wed 22 Mar 2017 01:14:54 PM UTCpstrayAttached File-=>Added infocmp-xterm-256color.txt, #40057
      Attached File-=>Added infocmp-screen.xterm-256color.txt, #40058
      Attached File-=>Added infocmp-screen-bce.txt, #40059
      Attached File-=>Added term-test.pl, #40060
    Wed 22 Mar 2017 08:53:51 AM UTCamadeStatusNone=>Need Info
    Tue 21 Mar 2017 01:30:39 PM UTCpstrayAttached File-=>Added terminal-noerror.png, #40045
      Attached File-=>Added screen-error.png, #40046

    Back to the top

    Powered by Savane 3.1-cleanup1