Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 599792 - sys-apps/gentoo-functions: does not accept -C for --nocolor (used by sys-devel/gcc-config at least)
Summary: sys-apps/gentoo-functions: does not accept -C for --nocolor (used by sys-deve...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: InVCS
Depends on: 626642
Blocks: 504118
  Show dependency tree
 
Reported: 2016-11-15 13:34 UTC by Michael Haubenwallner (RETIRED)
Modified: 2023-02-18 06:37 UTC (History)
6 users (show)

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


Attachments
ambitious patch to fix this (nocolor-C.patch,350 bytes, patch)
2017-02-22 18:37 UTC, Ben Kohler
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Haubenwallner (RETIRED) gentoo-dev 2016-11-15 13:34:47 UTC
Noticed while porting Prefix to Cygwin:

To disable colorized output,
gentoo-functions' /lib/gentoo/functions.sh accepts '--nocolor|-nc', while
openrc's /etc/init.d/functions.sh accepts '--nocolor|--nocolour|-C'.

Now there is at least pkg_postinst() in (stable) sys-devel/gcc-config-*.ebuild using `gcc-config -C` rather than `gcc-config --nocolor`: blocking #504118 for now.

Not sure if anyone should switch to --nocolor or gentoo-functions should support -C (and probably --nocolour) though.
Comment 1 Dainius Masiliūnas 2016-11-15 17:12:12 UTC
Using "-nc" seems very non-standard to me to begin with, since the assumption would rather be that it's a combination of -n and -c. Switching that to -C would make sense.
Comment 2 Ben Kohler gentoo-dev 2017-02-22 18:37:40 UTC
Created attachment 464744 [details, diff]
ambitious patch to fix this

This patch should take care of it.
Comment 3 Hank Leininger 2017-03-18 18:33:56 UTC
Just ran into this as well.  gcc-config's usage message states that -C disables color output, but it does not.  I have some system-install scripts that parse the output of gcc-config -l.  The color escape sequences were throwing off the parsing.
Comment 4 Mike Gilbert gentoo-dev 2017-05-18 19:26:51 UTC
commit 9053b4502c0faf37c42c553ab38fb4c0137c23fc
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Thu May 18 15:24:15 2017 -0400

    Support more permutations of --nocolor

    Bug: https://bugs.gentoo.org/599792

diff --git a/functions.sh b/functions.sh
index 78d1479..3ea9daa 100644
--- a/functions.sh
+++ b/functions.sh
@@ -431,7 +431,7 @@ fi
 for arg in "$@" ; do
        case "${arg}" in
                # Lastly check if the user disabled it with --nocolor argument
-               --nocolor|-nc)
+               --nocolor|--nocolour|-nc|-C)
                        RC_NOCOLOR="yes"
                        ;;
        esac
Comment 5 Mike Gilbert gentoo-dev 2017-05-18 19:34:45 UTC
Released in gentoo-functions-0.12.
Comment 6 David Heidelberg (okias) 2017-07-30 11:10:39 UTC
So FIXED? Can we move on to stabilization request, to get also gcc-config stabilized?

Thank you
Comment 7 David Heidelberg (okias) 2017-07-30 19:40:18 UTC
Created stabilization request: #626642
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2017-10-03 20:45:38 UTC
(In reply to David Heidelberg (okias) from comment #6)
> So FIXED? 

Definitely.
Comment 9 kfm 2023-02-18 06:37:44 UTC
(In reply to Hank Leininger from comment #3)
> Just ran into this as well.  gcc-config's usage message states that -C
> disables color output, but it does not.  I have some system-install scripts
> that parse the output of gcc-config -l.  The color escape sequences were
> throwing off the parsing.

I realise this is an old bug but, for the record, this was haphazardly fixed by https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=1c801ce, then properly fixed by https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=eb36c30. That is, any e-function that prints to STDOUT will ensure that the ECMA-48 SGR colour sequences are excluded if STDOUT it not a tty at the time. Likewise for STDERR. Once gentoo-functions-0.20 is released and widespread, you will no longer need to specify -C for your use case.