Bug 1166430 - screen: please provide a $TERM entry which advertises 256 colors when possible
Summary: screen: please provide a $TERM entry which advertises 256 colors when possible
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: screen
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Hracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1165439
TreeView+ depends on / blocked
 
Reported: 2014-11-21 00:50 UTC by Zbigniew Jędrzejewski-Szmek
Modified: 2015-12-02 16:33 UTC (History)
8 users (show)

Fixed In Version:
Clone Of: 1165439
Environment:
Last Closed: 2015-12-02 05:06:17 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Zbigniew Jędrzejewski-Szmek 2014-11-21 00:50:09 UTC
tl;dr screen says that it supports 8 colors, even when started with $TERM=xterm-256color in the environment. Please provide full 256 color support and set TERM=screen-256color.

+++ This bug was initially created as a clone of Bug #1165439 +++

Description of problem:
I found that gnome-terminal no longer sets COLORTERM, and thus 256term.sh doesn't patch up TERM=xterm or TERM=screen to their 256color variants.

Version-Release number of selected component (if applicable):
initscripts-9.56.1-4.fc21.x86_64
gnome-terminal-3.14.2-1.fc21.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Open gnome-terminal
2. echo $TERM
3. Run screen/tmux
4. echo $TERM

Actual results:
First "xterm", then "screen".

Expected results:
On F20, it would get "xterm-256color" and "screen-256color".
COLORTERM was still being set by gnome-terminal at that time.

Additional info:

commit 1d5c1b6ca6373c1301494edbc9e43c3e6a9c9aaf
Author: Christian Persch <chpe>
Date:   Sat Apr 26 19:13:21 2014 +0200

    screen: Stop setting COLORTERM env var
    
    COLORTERM is a long-obsolete slang-only variable used to work around
    broken termcap/terminfo entries.

https://git.gnome.org/browse/gnome-terminal/commit/?id=1d5c1b6ca6373c1301494edbc9e43c3e6a9c9aaf

--- Additional comment from Josh Stone on 2014-11-18 20:05:50 EST ---

As a workaround, I've added this to my .bashrc, before global files are sourced:

if test -z "$COLORTERM" &&
    readlink /proc/$PPID/exe | grep -q gnome-terminal
then
    export COLORTERM=gnome-terminal
fi

Obviously, that can only check the immediate parent process, but so far it's ok.

--- Additional comment from Zbigniew Jędrzejewski-Szmek on 2014-11-20 19:42:33 EST ---

Whoah, what a mess ;)

So, gnome-terminal sets a $TERM entry which does not advertise full capabalities. Instead of changing that, we try to fix it up in the shell using a hacky scripts. This does not make any sense to me.

(Even if there were buggy programs which refused to work with TERM=xterm-256color, which I guess was the primal reason why it was not set properly when xterm or gnome-terminal gained 256 color support, they most likely have been fixed, since 256term.sh has been setting TERM=xterm-256color for many years now. So even if there was a reason no to do it, there isn't one now.)

Let's fix this properly. After-the-fact guessing whether a terminal supports 256 colors is not possible to do cleanly [1]. The only sane way is to set it properly from the terminal emulator program.

So I propose a two step procedure:

1. Make gnome-terminal, xterm, screen, tmux, and whatever else set a $TERM entry which advertises 256 colors. I'll file bugs for gnome-terminal and screen.

2. Wait a bit for 1. to happen, then drop 256term.* from initscripts.

The rationale is that when 1. is done, the 256term.* scripts will be noops, so doing things in this order should provide a smooth transition.

[1] http://unix.stackexchange.com/questions/23763/checking-how-many-colors-my-terminal-emulator-supports/23789#23789

Comment 1 Fedora End Of Life 2015-11-04 14:46:04 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Fedora End Of Life 2015-12-02 05:06:24 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.