commit:     360d18ba7cfbbd285f5ed6d97892778685b8a106
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 17 17:29:55 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jul 17 17:29:55 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=360d18ba

initialize_portage_env: init color and quiet defaults early

profile init code may use warn etc so ensure we have colours defined and
quiet setup via fallback

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index 6ebb9e2..010675e 100644
--- a/main.c
+++ b/main.c
@@ -979,6 +979,14 @@ initialize_portage_env(void)
        const char *configroot = getenv("PORTAGE_CONFIGROOT");
        char *primary_overlay = NULL;
 
+       /* ensure color strings are initialised, code below here may use
+        * e.g. warn which uses them */
+       color_clear();
+
+       /* set quiet early in the game, bug #735134 */
+       if (getenv("PORTAGE_QUIET") != NULL)
+               setup_quiet();
+
        /* initialize all the properties with their default value */
        for (i = 0; vars_to_read[i].name; ++i) {
                var = &vars_to_read[i];
@@ -1221,9 +1229,6 @@ initialize_portage_env(void)
                }
        }
 
-       if (getenv("PORTAGE_QUIET") != NULL)
-               setup_quiet();
-
        if (nocolor) {
                color_clear();
                setenv("NOCOLOR", "true", 1);

Reply via email to