dovecot-2.0: config: When we detect a conflict, log where in con...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 4 00:33:49 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/864693ced870
changeset: 9862:864693ced870
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 03 17:33:40 2009 -0400
description:
config: When we detect a conflict, log where in config it came from.

diffstat:

3 files changed, 11 insertions(+), 6 deletions(-)
src/config/config-filter.c |    5 +++--
src/config/config-filter.h |    1 +
src/config/config-parser.c |   11 +++++++----

diffs (57 lines):

diff -r 717688db5e82 -r 864693ced870 src/config/config-filter.c
--- a/src/config/config-filter.c	Thu Sep 03 17:33:05 2009 -0400
+++ b/src/config/config-filter.c	Thu Sep 03 17:33:40 2009 -0400
@@ -149,8 +149,9 @@ config_module_parser_apply_changes(struc
 		if (settings_parser_apply_changes(dest[i].parser,
 						  src->parsers[i].parser, pool,
 						  error_r) < 0) {
-			*error_r = t_strdup_printf("Conflict in setting %s",
-						   *error_r);
+			*error_r = t_strdup_printf("Conflict in setting %s "
+				"found from filter at %s", *error_r,
+				src->file_and_line);
 			return -1;
 		}
 	}
diff -r 717688db5e82 -r 864693ced870 src/config/config-filter.h
--- a/src/config/config-filter.h	Thu Sep 03 17:33:05 2009 -0400
+++ b/src/config/config-filter.h	Thu Sep 03 17:33:40 2009 -0400
@@ -11,6 +11,7 @@ struct config_filter {
 
 struct config_filter_parser {
 	struct config_filter filter;
+	const char *file_and_line;
 	/* NULL-terminated array of parsers */
 	struct config_module_parser *parsers;
 };
diff -r 717688db5e82 -r 864693ced870 src/config/config-parser.c
--- a/src/config/config-parser.c	Thu Sep 03 17:33:05 2009 -0400
+++ b/src/config/config-parser.c	Thu Sep 03 17:33:40 2009 -0400
@@ -166,6 +166,9 @@ config_add_new_parser(struct parser_cont
 
 	parser = p_new(ctx->pool, struct config_filter_parser, 1);
 	parser->filter = cur_section->filter;
+	parser->file_and_line =
+		p_strdup_printf(ctx->pool, "%s:%d",
+				ctx->cur_input->path, ctx->cur_input->linenum);
 	parser->parsers = cur_section->prev == NULL ? ctx->root_parsers :
 		config_module_parsers_init(ctx->pool);
 	array_append(&ctx->all_parsers, &parser, 1);
@@ -573,13 +576,13 @@ int config_parse_file(const char *path, 
 					     settings_parser_flags);
 	}
 
+	memset(&root, 0, sizeof(root));
+	root.path = path;
+	ctx.cur_input = &root;
+
 	p_array_init(&ctx.all_parsers, ctx.pool, 128);
 	ctx.cur_section = p_new(ctx.pool, struct config_section_stack, 1);
 	config_add_new_parser(&ctx);
-
-	memset(&root, 0, sizeof(root));
-	root.path = path;
-	ctx.cur_input = &root;
 
 	str = t_str_new(256);
 	full_line = t_str_new(512);


More information about the dovecot-cvs mailing list