Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 446176 - app-portage/eix-0.27.5-r1 - Produces differently coloured output depending on whether it's run as regular user or root.
Summary: app-portage/eix-0.27.5-r1 - Produces differently coloured output depending on...
Status: RESOLVED DUPLICATE of bug 438076
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Martin Väth
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 22:57 UTC by PM
Modified: 2012-12-07 21:15 UTC (History)
3 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 PM 2012-12-05 22:57:35 UTC
Since updating to 0.27.5(-r1) I noticed eix produces differently coloured, less readable output when ran as root.

Konsole screenshot: http://i.imgur.com/z7lRv.png
xterm screenshot: http://i.imgur.com/hYjF8.png

I can't think of any change I might have introduced on my system that could have caused this.

Also, I noticed that if I 'su - piotrek' back to my regular user from root, the colours stay dark.

Others applications that use coloured output (such as emerge) behave normally.

I noticed at least one other person has a similar problem: https://bugs.gentoo.org/show_bug.cgi?id=438076#c30

Reproducible: Always




Portage 2.2.0_alpha144 (default/linux/amd64/10.0/desktop, gcc-4.7.2, glibc-2.16.0, 3.6.10-pf x86_64)
=================================================================
System uname: Linux-3.6.10-pf-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9450_@_2.66GHz-with-gentoo-2.2
Timestamp of tree: Wed, 05 Dec 2012 22:00:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.8 [enabled]
app-shells/bash:          4.2_p39
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/ccache:          3.1.8
dev-util/cmake:           2.8.10.2
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.6
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.4_p6-r1, 1.9.6-r3, 1.11.6, 1.12.5
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3, 4.7.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo multimedia bitcoin roslin sunrise java-overlay dupa
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --quiet-build=n"
FCFLAGS="-O2 -march=native -pipe -ggdb"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles installsources merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -march=native -pipe -ggdb"
GENTOO_MIRRORS="http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LANG="pl_PL.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/multimedia /usr/local/portage/layman/bitcoin /usr/local/portage/layman/roslin /usr/local/portage/layman/sunrise /usr/local/portage/layman/java-overlay /usr/local/portage/moje"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X Xaw3d a52 aac aalib acl acpi alsa amd64 amr amrnb amrwb apng async audiofile automount avahi avresample bash-completion berkdb bfq bineditor bluetooth bluray branding bzip2 cairo cdda cddb cdparanoia cdr chdir clang cli consolekit cracklib crypt css cuda cups curl cxx dbus dirac disk-partition divx djvu dri dts dvd dvdr editor emboss emovix enca encode exchange exif faac faad fam fat ffmpeg fftw firefox firefox3 flac fontconfig fortran g3dvl gd gdbm geoip gif glitz gmedia gphoto2 gpm gtk hddtemp iconv id3 id3tag imagemagick inotify iostats ipod jpeg kde kde4 kdehiddenvisibility kipi kompare kpathsea kqemu ladspa lame laptop lastfm latex lcms libass libcaca libnotify libsamplerate lm_sensors lzma lzo mad matroska midi mjpeg mmap mmx mmxext mng modules mp3 mp3tunes mp4 mpeg mplayer mtp mudflap multilib musicbrainz ncurses networkmanager nls nptl nsplugin ntfs nvidia ogg okteta openal opencl opencore-amr opengl openmp optimized-qmake pam pango pch pcre pdf plasma png policykit portage ppds pppd private-headers pulseaudio qt3 qt3support qt4 qthelp raster readline realmedia roe scanner schroedinger sdl secure-delete semantic-desktop sensord session shaders slang sndfile solver soundtouch sourceview sparse spell sse sse2 sse3 sse4 sse41 sse4_1 sse4a ssl ssse3 startup-notification suid svg swat symlink syslog tcpd theora threads tiff truetype udev udisks unicode upnp upower usb vaapi vamp vcd vdpau vorbis wifi wmf wmp wxwidgets wxwindows x264 xcb xcomposite xml xscreensaver xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="pl" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Uladzimir Bely 2012-12-06 07:17:43 UTC
I can confirm this.

Different output colors 1) from user 2), from root after 'su' 3), from root after 'su -'

Also it seems all versions of eix >= 0.25.5 ignore package.keywords file(s). All right from user, but keyworded packages are shown as "will be downgraded" for root (It also visible on screenshots by Piotr Mitas), but it's a subject for another bug.
Comment 2 PM 2012-12-06 12:25:32 UTC
(In reply to comment #1)

> Also it seems all versions of eix >= 0.25.5 ignore package.keywords file(s).
> All right from user, but keyworded packages are shown as "will be
> downgraded" for root (It also visible on screenshots by Piotr Mitas), but
> it's a subject for another bug.

Where do you see this? On my screenshots the text is the same, only colours differ. I checked with a few -9999 packages I needed to put in package.keywords  and eix reports them all correctly as [I], not [D].
Comment 3 Martin Väth 2012-12-06 20:59:17 UTC
(In reply to comment #0)
> eix produces differently coloured [...] when ran as root.

Are your TERM settings the same before and after the su?

If they differ, this is probably the reason: Please report both values here.

If the are identical, we have to find which other environment variables
differ which are relevant to eix. Try something like this:

piotrek$ eix --dump >/tmp/eixuser
piotrek$ su -
# eix --dump >/tmp/eixroot
# diff /tmp/eixuser /tmp/eixroot
Comment 4 PM 2012-12-06 23:50:16 UTC
TERM is xterm in both cases. Here's the diff:

# diff /tmp/eixuser /tmp/eixroot 
691,693c691
< COLORFGBG="15;0"
< # changed locally, default was:
< # COLORFGBG=""
---
> COLORFGBG=""

I'm pretty sure I've never touched this variable.
Comment 5 Martin Väth 2012-12-07 08:27:17 UTC
Normally, this variable is set by rxvt or similar terminals and describes
there correctly the background color. This is why eix uses it for its
background-color heuristics.

I cannot test in the moment whether it is set by kterm, but I am absolutely
sure that it is not set by xterm (this I had tested).

I conjecture that it is set and exported by kde, giving the correct
value for kterm but the false value for xterm.

If it is only set by kde, this explains also the change in case of "su -":
Since it is not set by any shell initialization script and "su -" clears
the whole environment, the variable is not set after "su -".

The solution for your setting is probably to define in /etc/eixrc:

# Dark terminals (without xterm but with kterm)
TERM_DARK="linux cygwin putty kterm"
# Ignore COLORFBG>B
COLORFGBG_DARK=

Instead of the latter, I would recommend to configure KDE to export its
settings to non-KDE-programms (there was such an option in "systemsettings",
but I forgot where): Then your xterm has a black background which is
more readable anyway IMHO. Of course, this is up to you...

BTW: Do you use kde with default colors? In this case, I should at least
include kterm into the TERM_DARK defaults.
Comment 6 PM 2012-12-07 10:17:07 UTC
(In reply to comment #5)
> I cannot test in the moment whether it is set by kterm, but I am absolutely
> sure that it is not set by xterm (this I had tested).

As for xterm, it had the same colours as konsole because I started in from a shell inside konsole and the environment carried over. If I start xterm on it's own, it looks just as konsole after su -. This is a comparison with two versions of eix: http://i.imgur.com/MOlMs.png
In konsole the old version looks like the current "regular user look" for both root and regular user.

> The solution for your setting is probably to define in /etc/eixrc:
> 
> # Dark terminals (without xterm but with kterm)
> TERM_DARK="linux cygwin putty kterm"
> # Ignore COLORFBG>B
> COLORFGBG_DARK=

Is TERM=kterm set by konsole by default? As I said earlier, mine sets TERM=xterm. It could be some leftover from early versions though. Anyway, after changing konsole to export TERM=kterm and adding the TERM_DARK line it works fine now both as regular user an root.

> Instead of the latter, I would recommend to configure KDE to export its
> settings to non-KDE-programms (there was such an option in "systemsettings",
> but I forgot where): Then your xterm has a black background which is
> more readable anyway IMHO. Of course, this is up to you...

That doesn't matter to me much, I use xterm very rarely. 
 
> BTW: Do you use kde with default colors? In this case, I should at least
> include kterm into the TERM_DARK defaults.

I believe so... If I did change something I did this many years ago and probably wouldn't remember. I do remember that in the days of KDE 3, white background was the default.
Comment 7 Martin Väth 2012-12-07 11:58:05 UTC
So we have an explanation of everything:

kde exports COLORFGBG correctly, leading to the eix heuristic to work
with konsole; after "su -" or starting xterm from konsole the variable
is reset resp. kept thus making the eix heuristics fail.

Since I do not know a way to improve the heuristic nor the defaults
can be changed reasonably (you are right: konsole sets TERM=xterm),
I think there is nothing which can be done to improve the situation
from the eix side.

The main problem remains that the heuristic is very poor...

Therefore closing as CANTFIX.
Comment 8 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2012-12-07 12:02:39 UTC
(In reply to comment #7)
> So we have an explanation of everything:
> 
> kde exports COLORFGBG correctly, leading to the eix heuristic to work
> with konsole; after "su -" or starting xterm from konsole the variable
> is reset resp. kept thus making the eix heuristics fail.
> 
> Since I do not know a way to improve the heuristic nor the defaults
> can be changed reasonably (you are right: konsole sets TERM=xterm),
> I think there is nothing which can be done to improve the situation
> from the eix side.
> 
> The main problem remains that the heuristic is very poor...
> 
> Therefore closing as CANTFIX.

Then why do previous versions not have these color problems?

What should users (like me) do to get back the previous behaviour?

Since July, I haven't seen this problem till now; so, something must have changed.
Comment 9 Martin Väth 2012-12-07 14:55:07 UTC
(In reply to comment #8)
> Then why do previous versions not have these color problems?

Because they did not use any heuristic to guess the background color:
they always assumed black background color which caused other problems.

> What should users (like me) do to get back the previous behaviour?

This is all explained in the ChangeLog (and in more detail in the man page).
In your case you will probably want to put into /etc/eixrc:
DARK=true
(and e.g. BG1=black to force black background on white xterm;
however, this again will lead to other problems e.g. with transparent
terminals.)

Or use the poor man's color scheme with only 8/16 colors throughout.

For simpler reference of both bugs, I mark this now as a duplicate,
although it is somewhat a different issue.

*** This bug has been marked as a duplicate of bug 438076 ***
Comment 10 PM 2012-12-07 16:13:08 UTC
Let me just add that this solution:
DARK=true
BG1=black
produces no problem whatsoever in transparent Konsole.
Comment 11 Martin Väth 2012-12-07 21:15:50 UTC
(In reply to comment #10)
> Let me just add that this solution:
> DARK=true
> BG1=black
> produces no problem whatsoever in transparent Konsole.

Look at the third screenshot in bug 438076.
(And comment to that bug please if you have suggestions how to improve
the situation).