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.
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.
Created attachment 464744 [details, diff] ambitious patch to fix this This patch should take care of it.
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.
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
Released in gentoo-functions-0.12.
So FIXED? Can we move on to stabilization request, to get also gcc-config stabilized? Thank you
Created stabilization request: #626642
(In reply to David Heidelberg (okias) from comment #6) > So FIXED? Definitely.
(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.