Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 251052 - [FEATURE REQUEST] we need a decolorise tool
Summary: [FEATURE REQUEST] we need a decolorise tool
Status: RESOLVED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-15 18:26 UTC by DEMAINE Benoît-Pierre, aka DoubleHP
Modified: 2008-12-16 11:59 UTC (History)
1 user (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 DEMAINE Benoît-Pierre, aka DoubleHP 2008-12-15 18:26:01 UTC
We need a tool to decolorise colorfull logs.

Example:
genkernel all | tee logfile ; cat logfile | mail plop@foo.bar ; rm logfile

This is a case where we do not want to use the nocolor option of genkernel. But, if we send the email with color full log, it will not be readable.

As workaround, I do this ATM:
cat logfile | sed "s/.\[[0-9\;]*m//g" | mail foo@bar

but, having a dedicated decolorising tool would be nice. And include it in an existing kit, like app-portage/gentoolkit ?
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2008-12-16 11:59:16 UTC
There are lots of ways to do this, but none of them are as good as not adding colour in the first place. Your workaround fixes the problem of colour having been added in the first place. Maybe you should write a little script, put it in /usr/local/bin and pipe all mail through there. Or you could do that work automatically on the receiving end, perhaps using a procmail recipe to filter control sequences from mail (using that oneliner of yours) coming in from specific hosts.

If you figure a way to do this systematically, other than not producing colour in output in the first place[1], then please let us know. Having an open bug about this doesn't make sense otherwise. It's probably better to bring this to a wider audience, say the gentoo-dev@ mailing list.

[1] By setting NOCOLOR=true in make.conf, which still doesn't strip colour from the output of dev-util/cmake and like build systems, but only from emerge itself.