diff mbox series

[02/12] qga: Rename config key 'blacklist' as 'denylist'

Message ID 20210202205824.1085853-3-philmd@redhat.com
State New
Headers show
Series misc: Replace the words 'blacklist/whitelist' | expand

Commit Message

Philippe Mathieu-Daudé Feb. 2, 2021, 8:58 p.m. UTC
Follow the inclusive terminology from the "Conscious Language in your
Open Source Projects" guidelines [*] and replace the word "blacklist"
appropriately.

[*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 docs/interop/qemu-ga.rst   |  2 +-
 qga/main.c                 | 15 +++++++++++----
 tests/test-qga.c           |  8 ++++----
 tests/data/test-qga-config |  2 +-
 4 files changed, 17 insertions(+), 10 deletions(-)

Comments

Daniel P. Berrangé Feb. 3, 2021, 10:17 a.m. UTC | #1
On Tue, Feb 02, 2021 at 09:58:14PM +0100, Philippe Mathieu-Daudé wrote:
> Follow the inclusive terminology from the "Conscious Language in your
> Open Source Projects" guidelines [*] and replace the word "blacklist"
> appropriately.
> 
> [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  docs/interop/qemu-ga.rst   |  2 +-
>  qga/main.c                 | 15 +++++++++++----
>  tests/test-qga.c           |  8 ++++----
>  tests/data/test-qga-config |  2 +-
>  4 files changed, 17 insertions(+), 10 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> 
> diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst
> index 3063357bb5d..9a590bf95cb 100644
> --- a/docs/interop/qemu-ga.rst
> +++ b/docs/interop/qemu-ga.rst
> @@ -125,7 +125,7 @@ pidfile        string
>  fsfreeze-hook  string
>  statedir       string
>  verbose        boolean
> -blacklist      string list
> +denylist       string list
>  =============  ===========
>  
>  See also
> diff --git a/qga/main.c b/qga/main.c
> index e7f8f3b1616..249fe06e8e5 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -962,6 +962,7 @@ static void config_load(GAConfig *config)
>      GError *gerr = NULL;
>      GKeyFile *keyfile;
>      g_autofree char *conf = g_strdup(g_getenv("QGA_CONF")) ?: get_relocated_path(QGA_CONF_DEFAULT);
> +    const gchar *denylist_key = "denylist";
>  
>      /* read system config */
>      keyfile = g_key_file_new();
> @@ -1008,10 +1009,16 @@ static void config_load(GAConfig *config)
>          config->retry_path =
>              g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr);
>      }
> +
>      if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) {
> +        g_warning("config using deprecated 'blacklist' key, now replaced"
> +                  " by the 'denylist' key.");

We should document the config file option deprecation in the norma
place for deprecations.

> +        denylist_key = "blacklist";
> +    }

Regards,
Daniel
Michal Suchánek Feb. 4, 2021, 9:45 a.m. UTC | #2
Hello,

On Tue, Feb 02, 2021 at 09:58:14PM +0100, Philippe Mathieu-Daudé wrote:
> Follow the inclusive terminology from the "Conscious Language in your
> Open Source Projects" guidelines [*] and replace the word "blacklist"
> appropriately.
> 
> [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  docs/interop/qemu-ga.rst   |  2 +-
>  qga/main.c                 | 15 +++++++++++----
>  tests/test-qga.c           |  8 ++++----
>  tests/data/test-qga-config |  2 +-
>  4 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst
> index 3063357bb5d..9a590bf95cb 100644
> --- a/docs/interop/qemu-ga.rst
> +++ b/docs/interop/qemu-ga.rst
> @@ -125,7 +125,7 @@ pidfile        string
>  fsfreeze-hook  string
>  statedir       string
>  verbose        boolean
> -blacklist      string list
> +denylist       string list
>  =============  ===========

this changes the config option but not the commandline option creating
disconnect between commanndline and config:

docs/interop/qemu-ga.rst:.. option:: -b, --blacklist=LIST
docs/interop/qemu-ga.rst:blacklist      string list

When making these 'inclusive' changes at least make sure you don't break
the software in question.

A simple grep would have told you.

Thanks

Michal
Michal Suchánek Feb. 4, 2021, 12:29 p.m. UTC | #3
On Thu, Feb 04, 2021 at 10:45:45AM +0100, Michal Suchánek wrote:
> Hello,
> 
> On Tue, Feb 02, 2021 at 09:58:14PM +0100, Philippe Mathieu-Daudé wrote:
> > Follow the inclusive terminology from the "Conscious Language in your
> > Open Source Projects" guidelines [*] and replace the word "blacklist"
> > appropriately.
> > 
> > [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md
> > 
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > ---
> >  docs/interop/qemu-ga.rst   |  2 +-
> >  qga/main.c                 | 15 +++++++++++----
> >  tests/test-qga.c           |  8 ++++----
> >  tests/data/test-qga-config |  2 +-
> >  4 files changed, 17 insertions(+), 10 deletions(-)
> > 
> > diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst
> > index 3063357bb5d..9a590bf95cb 100644
> > --- a/docs/interop/qemu-ga.rst
> > +++ b/docs/interop/qemu-ga.rst
> > @@ -125,7 +125,7 @@ pidfile        string
> >  fsfreeze-hook  string
> >  statedir       string
> >  verbose        boolean
> > -blacklist      string list
> > +denylist       string list
> >  =============  ===========
> 
> this changes the config option but not the commandline option creating
> disconnect between commanndline and config:
> 
> docs/interop/qemu-ga.rst:.. option:: -b, --blacklist=LIST
> docs/interop/qemu-ga.rst:blacklist      string list

Now I see it's addressed in patch 3 but with the patches arriving out of
order I have missed that. Maybe merging these two might make more sense.

Thanks

Michal
diff mbox series

Patch

diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst
index 3063357bb5d..9a590bf95cb 100644
--- a/docs/interop/qemu-ga.rst
+++ b/docs/interop/qemu-ga.rst
@@ -125,7 +125,7 @@  pidfile        string
 fsfreeze-hook  string
 statedir       string
 verbose        boolean
-blacklist      string list
+denylist       string list
 =============  ===========
 
 See also
diff --git a/qga/main.c b/qga/main.c
index e7f8f3b1616..249fe06e8e5 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -962,6 +962,7 @@  static void config_load(GAConfig *config)
     GError *gerr = NULL;
     GKeyFile *keyfile;
     g_autofree char *conf = g_strdup(g_getenv("QGA_CONF")) ?: get_relocated_path(QGA_CONF_DEFAULT);
+    const gchar *denylist_key = "denylist";
 
     /* read system config */
     keyfile = g_key_file_new();
@@ -1008,10 +1009,16 @@  static void config_load(GAConfig *config)
         config->retry_path =
             g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr);
     }
+
     if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) {
+        g_warning("config using deprecated 'blacklist' key, now replaced"
+                  " by the 'denylist' key.");
+        denylist_key = "blacklist";
+    }
+    if (g_key_file_has_key(keyfile, "general", denylist_key, NULL)) {
         config->bliststr =
-            g_key_file_get_string(keyfile, "general", "blacklist", &gerr);
-        config->blacklist = g_list_concat(config->blacklist,
+            g_key_file_get_string(keyfile, "general", denylist_key, &gerr);
+        config->denylist = g_list_concat(config->denylist,
                                           split_list(config->bliststr, ","));
     }
 
@@ -1071,8 +1078,8 @@  static void config_dump(GAConfig *config)
                            config->log_level == G_LOG_LEVEL_MASK);
     g_key_file_set_boolean(keyfile, "general", "retry-path",
                            config->retry_path);
-    tmp = list_join(config->blacklist, ',');
-    g_key_file_set_string(keyfile, "general", "blacklist", tmp);
+    tmp = list_join(config->denylist, ',');
+    g_key_file_set_string(keyfile, "general", "denylist", tmp);
     g_free(tmp);
 
     tmp = g_key_file_to_data(keyfile, NULL, &error);
diff --git a/tests/test-qga.c b/tests/test-qga.c
index eb33264e8ed..c2836244b04 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -655,7 +655,7 @@  static void test_qga_get_time(gconstpointer fix)
     qobject_unref(ret);
 }
 
-static void test_qga_blacklist(gconstpointer data)
+static void test_qga_denylist(gconstpointer data)
 {
     TestFixture fix;
     QDict *ret, *error;
@@ -663,7 +663,7 @@  static void test_qga_blacklist(gconstpointer data)
 
     fixture_setup(&fix, "-b guest-ping,guest-get-time", NULL);
 
-    /* check blacklist */
+    /* check denylist */
     ret = qmp_fd(fix.fd, "{'execute': 'guest-ping'}");
     g_assert_nonnull(ret);
     error = qdict_get_qdict(ret, "error");
@@ -752,7 +752,7 @@  static void test_qga_config(gconstpointer data)
     g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error));
     g_assert_no_error(error);
 
-    strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error);
+    strv = g_key_file_get_string_list(kf, "general", "denylist", &n, &error);
     g_assert_cmpint(n, ==, 2);
     g_assert_true(g_strv_contains((const char * const *)strv,
                                   "guest-ping"));
@@ -997,7 +997,7 @@  int main(int argc, char **argv)
     g_test_add_data_func("/qga/fsfreeze-status", &fix,
                          test_qga_fsfreeze_status);
 
-    g_test_add_data_func("/qga/blacklist", NULL, test_qga_blacklist);
+    g_test_add_data_func("/qga/denylist", NULL, test_qga_denylist);
     g_test_add_data_func("/qga/config", NULL, test_qga_config);
     g_test_add_data_func("/qga/guest-exec", &fix, test_qga_guest_exec);
     g_test_add_data_func("/qga/guest-exec-invalid", &fix,
diff --git a/tests/data/test-qga-config b/tests/data/test-qga-config
index 4bb721a4a18..d9ddc1a4d96 100644
--- a/tests/data/test-qga-config
+++ b/tests/data/test-qga-config
@@ -5,4 +5,4 @@  path=/path/to/org.qemu.guest_agent.0
 pidfile=/var/foo/qemu-ga.pid
 statedir=/var/state
 verbose=true
-blacklist=guest-ping;guest-get-time
+denylist=guest-ping;guest-get-time