]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Clean up
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 30 Jan 2018 20:36:19 +0000 (21:36 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 30 Jan 2018 20:36:19 +0000 (21:36 +0100)
MANUAL.txt
NEWS.txt
conf.c
test/suites/base.bash

index 01dafae2fd5c49a08b71f6f367bf2574c18dc45e..7e1ae40ccd1aecd583b03626f5308ad113a78d63 100644 (file)
@@ -223,11 +223,12 @@ Some settings are boolean values (i.e. truth values). In a configuration file,
 such values must be set to the string *true* or *false*. For the corresponding
 environment variables, the semantics are a bit different: a set environment
 variable means ``true'' (even if set to the empty string), the following
-case-insensitive negative values are considered an error (rather than surprise
-the user): "0", "false", "disable" and "no", and an unset environment variable
-means ``false''. Each boolean environment variable also has a negated form
-starting with *CCACHE_NO*. For example, *CCACHE_COMPRESS* can be set to force
-compression and *CCACHE_NOCOMPRESS* can be set to force no compression.
+case-insensitive negative values are considered an error (rather than
+surprising the user): *0*, *false*, *disable* and *no*, and an unset
+environment variable means ``false''. Each boolean environment variable also
+has a negated form starting with *CCACHE_NO*. For example, *CCACHE_COMPRESS*
+can be set to force compression and *CCACHE_NOCOMPRESS* can be set to force no
+compression.
 
 
 Configuration settings
index c46d555430aa9b57bbdef4891b8bd77e065fb917..733da7584012df9c046046cc7e24245b9dc1b77b 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -22,10 +22,10 @@ New features and improvements
 - Added support for nvcc compiler options `--compiler-bindir/-ccbin`,
   `--output-directory/-odir` and `--libdevice-directory/-ldir`.
 
-- Boolean configuration settings no longer accept the following
-  (case-insensitive) values: "0", "false", "disable" and "no". All other values
-  are accepted and taken to mean "true". This is intended to avoid users
-  setting eg CCACHE_DISABLE=0 and expecting the cache to be used.
+- Boolean environment variable settings no longer accept the following
+  (case-insensitive) values: `0`, `false`, `disable` and `no`. All other values
+  are accepted and taken to mean "true". This is to stop users from setting
+  e.g. `CCACHE_DISABLE=0` and then expect the cache to be used.
 
 
 Bug fixes
diff --git a/conf.c b/conf.c
index 6a0a9e66f5e44850de3d787c7071c9dd8471e9af..20e744a02e379cd42af0db12a4c9f014e80e5226 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -241,16 +241,15 @@ handle_conf_setting(struct conf *conf, const char *key, const char *value,
        }
 
        if (from_env_variable && item->parser == parse_bool) {
-               // Special rule for boolean settings from the environment:
-               // "0", "false", "disable" and "no" (case insensitive) are invalid,
-               // and all other values mean true.
+               // Special rule for boolean settings from the environment: "0", "false",
+               // "disable" and "no" (case insensitive) are invalid, and all other values
+               // mean true.
                //
-               // Previously any value meant true, but this was surprising to
-               // users, who might do something like CCACHE_DISABLE=0 and expect
-               // ccache to be enabled.
-
-               if (!strcmp(value, "0") || !strcasecmp(value, "false") ||
-                               !strcasecmp(value, "disable") || !strcasecmp(value, "no")) {
+               // Previously any value meant true, but this was surprising to users, who
+               // might do something like CCACHE_DISABLE=0 and expect ccache to be
+               // enabled.
+               if (str_eq(value, "0") || strcasecmp(value, "false") == 0
+                   || strcasecmp(value, "disable") == 0 || strcasecmp(value, "no") == 0) {
                        fatal("invalid boolean environment variable value \"%s\"", value);
                }
 
index 06eac9179e2937e6231de934c839ea4f7ec515fe..5ff9ab456ba5b533442e38e71519295e31a1f8eb 100644 (file)
@@ -913,14 +913,14 @@ EOF
     # -------------------------------------------------------------------------
     TEST "Invalid boolean environment configuration options"
 
-    for invalid_val in 0 false FALSE disable no ; do
-        CCACHE_DISABLE=$invalid_val $CCACHE $COMPILER --version > /dev/null 2>&1
+    for invalid_val in 0 false FALSE disable DISABLE no NO; do
+        CCACHE_DISABLE=$invalid_val $CCACHE $COMPILER --version >&/dev/null
         if [ $? -eq 0 ] ; then
-            test_failed "'$invalid_val' should be rejected for boolean env vars"
+            test_failed "boolean env var '$invalid_val' should be rejected"
         fi
-        CCACHE_NODISABLE=$invalid_val $CCACHE $COMPILER --version > /dev/null 2>&1
+        CCACHE_NODISABLE=$invalid_val $CCACHE $COMPILER --version >&/dev/null
         if [ $? -eq 0 ] ; then
-            test_failed "'$invalid_val' should be rejected for boolean env vars"
+            test_failed "boolean env var '$invalid_val' should be rejected"
         fi
     done
 }