From 7bef7e9b3b19cbbc3f4f185fe0e0caa2faae544a Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Fri, 16 Apr 2021 13:55:56 +0200 Subject: [PATCH] common: make y2c.py choke on duplicate keys Commit 5505fc0051a3 ("common: generate legacy_config_opts.h from .yaml.in files") inadvertently reverted a change of a default value by adding a second "default" key with the old value. This was corrected in commit 75e07f8638ef ("common/options/global: correct default of auth_mon_ticket_ttl"), but highlights that mis-merging a yaml file is rather easy. To prevent this happening again, fail the build if duplicate keys exist in any of src/common/options/*.yaml.in files. Signed-off-by: Ilya Dryomov --- src/common/options/y2c.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/common/options/y2c.py b/src/common/options/y2c.py index 8064177296f23..3ff34fa8239a8 100755 --- a/src/common/options/y2c.py +++ b/src/common/options/y2c.py @@ -201,6 +201,7 @@ def yaml_to_h(opt): else: return '' + TEMPLATE_CC = '''#include "common/options.h" {headers} @@ -212,6 +213,26 @@ std::vector