commit:     b78da6155975faa519f93ec0bebe9830dd265c09
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 22 23:19:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep  9 23:48:44 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b78da615

install-qa-check.d: try to detect gcc warnings past color

We have some code we use for config-impl-decl which can strip color
codes out via sed. This is always necessary for config.log because if
color exists it will still be there.

The assumption was, likely, that build.log as managed by portage will
also be ansifilter'd by portage, and therefore stripping color is
unnecessary. But in fact, some people do like color and intentionally
avoid stripping it. This rendered the QA check effectively broken.
Instead we should make no assumptions, and explicitly strip this too.

Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1375
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/install-qa-check.d/90gcc-warnings | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/install-qa-check.d/90gcc-warnings 
b/bin/install-qa-check.d/90gcc-warnings
index 2e728268e1..c7e3d6a8a0 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -162,7 +162,7 @@ gcc_warn_check() {
                # Force C locale to work around slow multibyte locales, bug 
#160234
                # Force text mode as newer grep will treat non-ASCII (e.g. 
UTF-8) as
                # binary when we run in the C locale.
-               f=$(LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E -a 
"${joined_msgs}" "${PORTAGE_LOG_FILE}" | uniq)
+               f=$(LC_ALL='C' sed -E -e $'s/\033\[[0-9;]*[A-Za-z]//g' < 
"${PORTAGE_LOG_FILE}" | LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E -a 
"${joined_msgs}" | uniq)
                if [[ -n ${f} ]] ; then
                        abort="yes"
 

Reply via email to