commit:     ee1e2f10fa2f739bddee200e17360a618c9dfb3a
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu May 22 20:51:33 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 07:37:31 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ee1e2f10

90gcc-warnings: employ LC_COLLATE and LC_CTYPE consistently

Presently, LC_ALL=C is set for the invocation of sed(1), whereas
LC_COLLATE and LC_CTYPE are set for the invocation of grep(1). This is
inconsistent in so far as LC_ALL is permitted to override the intended
character type and collation, yet only in the case of the latter. Given
that the processing of the log occurs in a subshell, render things
consistent by exporting all of LC_ALL, LC_COLLATE and LC_CTYPE.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/install-qa-check.d/90gcc-warnings | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/install-qa-check.d/90gcc-warnings 
b/bin/install-qa-check.d/90gcc-warnings
index 185deaa53a..0662a94637 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -151,14 +151,15 @@ gcc_warn_check() {
        # Force text mode as newer grep will treat non-ASCII (e.g. UTF-8) as
        # binary when we run in the C locale.
        f=$(
+               export LC_ALL= LC_COLLATE=C LC_CTYPE=C
                IFS='|'
                if [[ ${PORTAGE_LOG_FILE} == *.gz ]]; then
                        gzip -cd -- "${PORTAGE_LOG_FILE}"
                else
                        cat -- "${PORTAGE_LOG_FILE}"
                fi \
-               | LC_ALL=C sed -E -e $'s/\033\[[0-9;]*[A-Za-z]//g' \
-               | LC_CTYPE=C LC_COLLATE=C grep -E -a "${msgs[*]}" \
+               | sed -E -e $'s/\033\[[0-9;]*[A-Za-z]//g' \
+               | grep -E -a "${msgs[*]}" \
                | uniq
        )
        if [[ -n ${f} ]] ; then

Reply via email to