Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 317929 - app-shells/bash-4.0_p37 - color support is broken
Summary: app-shells/bash-4.0_p37 - color support is broken
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-30 20:08 UTC by Pillar Vandyke
Modified: 2010-05-08 02:12 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pillar Vandyke 2010-04-30 20:08:47 UTC
After updating world terminal color support stopped working.

Reproducible: Always

Steps to Reproduce:
1. Create "~/.dir_colors" and "/etc/DIR_COLORS" containing only comments (e.g. default one).
2. Start new instance of bash shell.

Actual Results:  
Default bash prompt is not colored.

Expected Results:  
Default bash prompt should be colored. I.e. green for user and red for root.

/etc/bash/bashrc - lines 45-50:
Bash retrieves supportable color terminals list from "~/.dir_colors" and "/etc/DIR_COLORS". If files do not exist then it retrieves it from "dircolors --print-database". If files exist but contain nothing except comments (e.g. default DIR_COLORS) then bash ends up with empty list unable to match any available TERM value.
Comment 1 Panagiotis Christopoulos (RETIRED) gentoo-dev 2010-05-05 10:47:20 UTC
What do you propose exactly here? Ok, maybe you have a little point, but why /etc/DIR_COLORS would be empty? It's part of coreutils, and default bashrc uses it.  
Comment 2 Pillar Vandyke 2010-05-05 12:42:38 UTC
(In reply to comment #1)
> What do you propose exactly here? Ok, maybe you have a little point, but why
> /etc/DIR_COLORS would be empty? It's part of coreutils, and default bashrc uses
> it.  
> 

As I see the problem:
1. Bash has to recognize color terminals.
2. To perform this it needs to retrieve a supportable terminals list.
3. There are two ways of doing that:
    a. Parse DIR_COLORS -> get system list.
    b. Use bash database in case of exception -> get default list.

I do not think that the empty system list is a correct value. Empty system list is the same thing in nature as the absence of it and should be processed the same way i.e. by using the default list.

Why would DIR_COLORS be empty? I do not know. This is just an exceptional situation that is not processed by bashrc or processed incorrectly. I think that in my case coreutils simply replaced it with an empty file after updating world.
Comment 3 SpanKY gentoo-dev 2010-05-05 18:41:07 UTC
the *default* prompt relies on the dircolors database.  if you break the dircolors database, then you need to declare your own prompt if you want colors.