From abfa2247afc6be6db937510122a7b17907ed0777 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 14 Sep 2015 08:53:17 -0700 Subject: [PATCH] [v9_10] spurious spaces in named-checkconf -p 4205. [bug] 'named-checkconf -p' could include unwanted spaces when printing tuples with unset optional fields. [RT #40731] --- CHANGES | 4 ++++ bin/tests/system/checkconf/good.conf | 2 +- lib/isccfg/parser.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 31ba49da03..9efe8d7e02 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4205. [bug] 'named-checkconf -p' could include unwanted spaces + when printing tuples with unset optional fields. + [RT #40731] + 4204. [bug] 'dig +trace' failed to lookup the correct type if the initial root ns query was retried. [RT #40296] diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf index d14ccd8580..e4cde7cbec 100644 --- a/bin/tests/system/checkconf/good.conf +++ b/bin/tests/system/checkconf/good.conf @@ -111,7 +111,7 @@ view "second" { zone "." { type redirect; masters { - 1.2.3.4 ; + 1.2.3.4; }; }; dnssec-lookaside "." trust-anchor "dlv.isc.org."; diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 5d195ae7d2..3b864a425b 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -262,10 +262,11 @@ cfg_print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { for (f = fields, i = 0; f->name != NULL; f++, i++) { const cfg_obj_t *fieldobj = obj->value.tuple[i]; - if (need_space) - cfg_print_chars(pctx, " ", 1); + if (need_space && fieldobj->type->rep != &cfg_rep_void) + cfg_print_cstr(pctx, " "); cfg_print_obj(pctx, fieldobj); - need_space = ISC_TF(fieldobj->type->print != cfg_print_void); + need_space = ISC_TF(need_space || + fieldobj->type->print != cfg_print_void); } } @@ -277,7 +278,7 @@ cfg_doc_tuple(cfg_printer_t *pctx, const cfg_type_t *type) { for (f = fields; f->name != NULL; f++) { if (need_space) - cfg_print_chars(pctx, " ", 1); + cfg_print_cstr(pctx, " "); cfg_doc_obj(pctx, f->type); need_space = ISC_TF(f->type->print != cfg_print_void); }