Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 820236 - sys-apps/iproute2: Add support for coloring 'ip' output by default
Summary: sys-apps/iproute2: Add support for coloring 'ip' output by default
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-25 16:18 UTC by Jonathan Plews
Modified: 2024-06-28 14:26 UTC (History)
5 users (show)

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


Attachments
iproute2-default-color-auto.patch (iproute2-default-color-auto.patch,186 bytes, patch)
2021-10-26 17:48 UTC, Patrick McLean
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Plews 2021-10-25 16:18:05 UTC
Hi,

alias ip='ip --color=auto' would enable helpful highlighting for this command

I have not seen any issues with this myself and it seems useful enough thing for such a common tool.
Comment 1 Patrick McLean gentoo-dev 2021-10-26 17:48:31 UTC
Created attachment 746838 [details, diff]
iproute2-default-color-auto.patch

I have been using this patch on all my systems for awhile now. It is completely shell agnostic, and enables coloured output if outputting to a terminal.

Just drop this at /etc/portage/patches/sys-apps/iproute2/iproute2-default-color-auto.patch and rebuild iproute2.
Comment 2 Jonathan Plews 2021-10-28 09:29:18 UTC
Hi, I'd considered that approach but didn't want to change ip from how it comes as much as I agree the default should be this way round. 

The alias in system bashrc would make a nicer default in many situations, and it felt the best way to get a certain system behavior for some handbook related stuff
Comment 3 Jonathan Plews 2022-06-30 10:57:48 UTC
I've ended up with other patches so started using this too, it was only a matter of time before the merits became evident, ty.


Is there a reason why the patch isn't in by default?

no-color exists for those who want it and everyone else saves brain work if this is enabled, also with ipv6 having multiple addresses I find it even more useful.

Regards
Comment 4 Patrick McLean gentoo-dev 2022-07-06 22:26:55 UTC
Why colour is off by default is a question for upstream, Gentoo tries not to apply patches to upstream packages unless there is a good reason for said patch.
Comment 5 Jonathan Plews 2022-07-07 19:11:17 UTC
it's in the general interest of most users

any issues with tty detection must be irrelevant if grep can have color=auto

upstream looks difficult to interact with about this, whatever the actual reason time alone categorises it as deadlock

thinking wider, if you can accept that there is an energy and attention cost to processing text and that we can use colours to reduce this load, then it's also beneficial


that's about all I can think of, if I should rename the bug or do something other than just close it please let me know
Comment 6 Larry the Git Cow gentoo-dev 2022-08-12 19:25:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=536cf403364a92aa6dbfb443da92ce5fe2e71277

commit 536cf403364a92aa6dbfb443da92ce5fe2e71277
Author:     Patrick McLean <chutzpah@gentoo.org>
AuthorDate: 2022-08-12 19:24:13 +0000
Commit:     Patrick McLean <chutzpah@gentoo.org>
CommitDate: 2022-08-12 19:24:13 +0000

    sys-apps/iproute2: Revbump, enable colour by default (bug #820236)
    
    Also add patch to 9999 ebuild.
    
    Closes: https://bugs.gentoo.org/820236
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>

 sys-apps/iproute2/files/iproute2-default-color-auto.patch          | 7 +++++++
 .../iproute2/{iproute2-5.19.0.ebuild => iproute2-5.19.0-r1.ebuild} | 1 +
 sys-apps/iproute2/iproute2-9999.ebuild                             | 1 +
 3 files changed, 9 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2023-03-09 19:59:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af7b77d3b451d7d8b58babb471902d07d20ca803

commit af7b77d3b451d7d8b58babb471902d07d20ca803
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-03-09 19:55:07 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-03-09 19:55:07 +0000

    sys-apps/iproute2: drop iproute2-default-color-auto.patch
    
    This diverges from upstream defaults for no good reason. Users can set
    up a shell alias if they really want to enable colors by default.
    
    Bug: https://bugs.gentoo.org/820236
    Bug: https://bugs.gentoo.org/886187
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/iproute2/{iproute2-6.2.0.ebuild => iproute2-6.2.0-r1.ebuild} | 1 -
 sys-apps/iproute2/iproute2-9999.ebuild                                | 1 -
 2 files changed, 2 deletions(-)