unbound icon indicating copy to clipboard operation
unbound copied to clipboard

[FR] can unbound-checkconf be silenced when configuration is valid?

Open jpmens opened this issue 2 years ago • 2 comments

Current behavior

unbound-checkconf reports a valid and error-free configuration as

$ unbound-checkconf
unbound-checkconf: no errors in /usr/local/etc/unbound/unbound.conf

I've experienced several people (sadly, including myself!) who've been misled by the word errors in the output.

Can we (maybe optionally) silence the output?

Describe the desired feature

Ideal to me would be if unbound-checkconf were completely silent in good Unix manner, such as BIND's named-checkconf:

$ named-checkconf
$

In comparison, Knot-DNS issues the following diagnostic:

$ knotc conf-check
Configuration is valid

jpmens avatar Apr 14 '23 09:04 jpmens

FWIW, something as trivial as this one line would do the job:

--- smallapp/unbound-checkconf.c
+++ smallapp/unbound-checkconf.c
@@ -981,7 +981,8 @@ checkconf(const char* cfgfile, const char* opt, int final)
        check_fwd(cfg);
        check_hints(cfg);
        check_auth(cfg);
-       printf("unbound-checkconf: no errors in %s\n", cfgfile);
+       if (getenv("UNBOUND_CHECKCONF_QUIET") == NULL)
+               printf("unbound-checkconf: no errors in %s\n", cfgfile);
        config_delete(cfg);
 }

jpmens avatar Apr 19 '23 10:04 jpmens

A new flag, for example -q could be introduced for the same effect as in the diff; I am not too fond of environment variables :) Alternatively, or in addition, the text could also be changed to:

$ unbound-checkconf
unbound-checkconf: Valid configuration in /usr/local/etc/unbound/unbound.conf

gthess avatar Oct 09 '23 12:10 gthess

Added a -q flag for this but did not alter the current text.

gthess avatar Apr 26 '24 12:04 gthess