commit:     376afc18b75908ceb1d3c783b3c717d6b842c491
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 11 09:37:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 11 10:36:30 2024 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=376afc18

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 <AT> 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(-)

diff --git a/data/sandbox.bashrc b/data/sandbox.bashrc
index 3b953b8..6c5e632 100644
--- a/data/sandbox.bashrc
+++ b/data/sandbox.bashrc
@@ -26,7 +26,7 @@ if [[ ${SANDBOX_INTRACTV} == "1" && -t 1 ]] || [[ 
${__SANDBOX_TESTING} == "yes"
 
        if [[ ${__SANDBOX_TESTING} != "yes" ]] ; then
                (
-               [[ ${NOCOLOR} == "true" || ${NOCOLOR} == "yes" || ${NOCOLOR} == 
"1" ]] && \
+               [[ ${NO_COLOR} == "true" || ${NO_COLOR} == "yes" || ${NO_COLOR} 
== "1" ]] && \
                        export RC_NOCOLOR="yes"
                source /lib/gentoo/functions.sh
                if [[ $? -ne 0 ]] ; then
@@ -93,7 +93,7 @@ if [[ ${SANDBOX_INTRACTV} == "1" && -t 1 ]] || [[ 
${__SANDBOX_TESTING} == "yes"
        fi
 
        cd "${PWD}"
-       if [[ ${NOCOLOR} != "true" && ${NOCOLOR} != "yes" && ${NOCOLOR} != "1" 
]] ; then
+       if [[ ${NO_COLOR} != "true" && ${NO_COLOR} != "yes" && ${NO_COLOR} != 
"1" ]] ; then
                export PS1="\[\e[31;01m\][s]\[\e[0m\] ${PS1}"
        else
                export PS1="[s] ${PS1}"

diff --git a/etc/sandbox.conf b/etc/sandbox.conf
index d8a6550..be89138 100644
--- a/etc/sandbox.conf
+++ b/etc/sandbox.conf
@@ -22,10 +22,10 @@
 #  operations caught by sandbox.  Default is "no"
 #SANDBOX_DEBUG="no"
 
-# NOCOLOR
+# NO_COLOR
 #
 #  Determine the use of color in the output.  Default is "false" (ie, use 
color)
-#NOCOLOR="false"
+#NO_COLOR="false"
 
 # SANDBOX_METHOD
 #

diff --git a/libsbutil/sb_efuncs.c b/libsbutil/sb_efuncs.c
index 7ded90d..79531de 100644
--- a/libsbutil/sb_efuncs.c
+++ b/libsbutil/sb_efuncs.c
@@ -19,7 +19,7 @@ const char *colors[] = {
 __attribute__((constructor))
 static void sbio_init(void)
 {
-       if (is_env_on(ENV_NOCOLOR)) {
+       if (is_env_on(ENV_NO_COLOR)) {
                size_t i;
                for (i = 0; i < ARRAY_SIZE(colors); ++i)
                        colors[i] = "";

diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h
index 6d284f1..6670098 100644
--- a/libsbutil/sbutil.h
+++ b/libsbutil/sbutil.h
@@ -35,7 +35,7 @@
 
 #define ENV_BASH_ENV           "BASH_ENV"
 
-#define ENV_NOCOLOR            "NOCOLOR"
+#define ENV_NO_COLOR            "NO_COLOR"
 
 #define ENV_SANDBOX_VERBOSE    "SANDBOX_VERBOSE"
 #define ENV_SANDBOX_DEBUG      "SANDBOX_DEBUG"

diff --git a/src/environ.c b/src/environ.c
index df8595b..b165280 100644
--- a/src/environ.c
+++ b/src/environ.c
@@ -194,7 +194,7 @@ static int setup_cfg_vars(struct sandbox_info_t 
*sandbox_info)
 {
        setup_cfg_var(ENV_SANDBOX_VERBOSE);
        setup_cfg_var(ENV_SANDBOX_DEBUG);
-       setup_cfg_var(ENV_NOCOLOR);
+       setup_cfg_var(ENV_NO_COLOR);
        setup_cfg_var(ENV_SANDBOX_METHOD);
 
        if (-1 == setup_access_var(ENV_SANDBOX_DENY))
@@ -304,8 +304,8 @@ char **setup_environ(struct sandbox_info_t *sandbox_info, 
bool interactive)
                sb_setenv(&new_environ, ENV_SANDBOX_VERBOSE, "1");
        if (!getenv(ENV_SANDBOX_DEBUG))
                sb_setenv(&new_environ, ENV_SANDBOX_DEBUG, opt_debug ? "1" : 
"0");
-       if (!getenv(ENV_NOCOLOR))
-               sb_setenv(&new_environ, ENV_NOCOLOR, "no");
+       if (!getenv(ENV_NO_COLOR))
+               sb_setenv(&new_environ, ENV_NO_COLOR, "no");
        if (!getenv(ENV_SANDBOX_METHOD))
                sb_setenv(&new_environ, ENV_SANDBOX_METHOD, "any");
        /* If LD_PRELOAD was not set, set it here, else do it below */

diff --git a/tests/test-skel-0.c b/tests/test-skel-0.c
index 91128d3..9cf18b8 100644
--- a/tests/test-skel-0.c
+++ b/tests/test-skel-0.c
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
                exit(1);
        }
 
-       if (getenv("NOCOLOR"))
+       if (getenv("NO_COLOR"))
                color_normal = color_green = color_yellow = color_red = "";
 
        test_ret = 0;

Reply via email to