The new quasi-standard for disabling ANSI color is to check for the NO_COLOR environment variable and disable color when the variable has a nonempty value. See https://no-color.org/: "Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color." Unfortunately Portage uses NOCOLOR instead, and checks for its value differently (e.g. for NOCOLOR=false). I suggest to update to the new standard. Presumably, the old variable should be kept in addition for some time, for backwards compatibility.
Maybe this is also a chance to consolidate the check a little. Currently it is all over the place: portage $ grep -r NOCOLOR | wc -l 37
Does this "https://bugs.gentoo.org/898224" mean upgrading the logic to look for NOCOLOR as well as NO_COLOR ( where true is not an empty str )
(In reply to Siddhanth Rathod from comment #2) > Does this "https://bugs.gentoo.org/898224" mean upgrading the logic to look > for NOCOLOR as well as NO_COLOR ( where true is not an empty str ) I think that the following would make sense: Disable color if either: - variable NO_COLOR has a non-empty value, _or_ - variable NOCOLOR has one of the values "true" or "yes". Both variables would be taken from the environment or from make.conf, and the --color={y,n} option would override them.
https://github.com/gentoo/portage/actions/runs/4307349809/jobs/7512362761 working on it
(In reply to Siddhanth Rathod from comment #4) > https://github.com/gentoo/portage/actions/runs/4307349809/jobs/7512362761 > working on it https://github.com/gentoo/portage/pull/1003
(In reply to Siddhanth Rathod from comment #5) > (In reply to Siddhanth Rathod from comment #4) > > https://github.com/gentoo/portage/actions/runs/4307349809/jobs/7512362761 > > working on it > > https://github.com/gentoo/portage/pull/1003 I rectify the issue indeed the logic is flawed !
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=0431aa7db28e69af309a8175ec9e13a23439e2fa commit 0431aa7db28e69af309a8175ec9e13a23439e2fa Author: Siddhanth Rathod <xsiddhanthrathod@gmail.com> AuthorDate: 2023-03-04 19:29:28 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-03-21 02:35:55 +0000 emerge: respect NO_COLOR Bug: https://bugs.gentoo.org/898224 Signed-off-by: Siddhanth Rathod <xsiddhanthrathod@gmail.com> Closes: https://github.com/gentoo/portage/pull/1003 Signed-off-by: Sam James <sam@gentoo.org> NEWS | 7 ++++++- bin/ebuild | 7 +++---- bin/egencache | 9 +++------ bin/etc-update | 1 + bin/isolated-functions.sh | 11 +++++++++-- bin/portageq | 6 ++---- bin/save-ebuild-env.sh | 2 +- lib/_emerge/AbstractEbuildProcess.py | 7 +++---- lib/_emerge/actions.py | 12 ++++++------ lib/portage/_emirrordist/main.py | 2 +- lib/portage/dbapi/_MergeProcess.py | 5 ++--- lib/portage/package/ebuild/_config/special_env_vars.py | 2 ++ lib/portage/package/ebuild/_ipc/QueryCommand.py | 6 ++---- lib/portage/tests/__init__.py | 3 ++- lib/portage/tests/resolver/ResolverPlayground.py | 4 ++-- lib/portage/tests/runTests.py | 2 +- lib/portage/util/__init__.py | 11 +++++++++++ 17 files changed, 57 insertions(+), 40 deletions(-)
ulm, I'd appreciate if if you could run portage-9999 for a bit (or indefinitely, as I'd really love the testing) to confirm everything works as intended for you. Thanks!
(In reply to Sam James from comment #8) > ulm, I'd appreciate if if you could run portage-9999 for a bit (or > indefinitely, as I'd really love the testing) to confirm everything works as > intended for you. I've used 9999 without and with NO_COLOR for a couple of days, and I haven't noticed any problems.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05f0b3b184011060c86787f93e16a29002bdc54a commit 05f0b3b184011060c86787f93e16a29002bdc54a Author: Sam James <sam@gentoo.org> AuthorDate: 2023-04-07 09:59:46 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-04-07 09:59:55 +0000 sys-apps/portage: add 3.0.46 Closes: https://bugs.gentoo.org/861659 Closes: https://bugs.gentoo.org/877271 Closes: https://bugs.gentoo.org/898224 Closes: https://bugs.gentoo.org/899898 Closes: https://bugs.gentoo.org/902189 Closes: https://bugs.gentoo.org/903917 Closes: https://bugs.gentoo.org/903926 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.46.ebuild | 285 +++++++++++++++++++++++++++++++++ 2 files changed, 286 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=376afc18b75908ceb1d3c783b3c717d6b842c491 commit 376afc18b75908ceb1d3c783b3c717d6b842c491 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-11-11 09:37:14 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-11-11 10:36:30 +0000 NOCOLOR -> NO_COLOR See https://no-color.org/. We already switched Portage and gentoolkit. Bug: https://bugs.gentoo.org/898224 Bug: https://bugs.gentoo.org/902551 Signed-off-by: Sam James <sam@gentoo.org> data/sandbox.bashrc | 4 ++-- etc/sandbox.conf | 4 ++-- libsbutil/sb_efuncs.c | 2 +- libsbutil/sbutil.h | 2 +- src/environ.c | 6 +++--- tests/test-skel-0.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-)