From: Timo Sirainen Date: Wed, 9 Apr 2025 11:11:42 +0000 (+0300) Subject: config: doveconf -dF - Add dovecot_storage_version X-Git-Tag: 2.4.2~810 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fedf386644e979f731854e53aa2e26d599776a5;p=thirdparty%2Fdovecot%2Fcore.git config: doveconf -dF - Add dovecot_storage_version --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 42eb82bbb1..288d5923ac 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -3077,6 +3077,20 @@ int config_parse_file(const char *path, enum config_parse_flags flags, hook_config_parser_begin(&ctx); } T_END; + if ((flags & CONFIG_PARSE_FLAG_DEFAULT_VERSION) != 0) { + /* Use default settings. Set dovecot_storage_version to the + latest version, so it won't cause a failure. + + When building from git we don't know the latest version, so + just use 9999. The version validity checks are disabled for + git builds, so this should work. */ + const char *version = version_is_valid(DOVECOT_VERSION) ? + DOVECOT_VERSION : "9999"; + if (config_apply_exact_line(&ctx, NULL, "dovecot_storage_version", + version) < 0) + i_panic("Couldn't set default dovecot_storage_version: %s", ctx.error); + } + internal.path = "Internal config_import"; ctx.cur_input->input = config_import == NULL ? i_stream_create_from_data("", 0) : diff --git a/src/config/config-parser.h b/src/config/config-parser.h index f7c5d08a28..be0714e918 100644 --- a/src/config/config-parser.h +++ b/src/config/config-parser.h @@ -37,6 +37,9 @@ enum config_parse_flags { CONFIG_PARSE_FLAG_MERGE_DEFAULT_FILTERS = BIT(9), /* Ignore unknown settings in the config file. */ CONFIG_PARSE_FLAG_IGNORE_UNKNOWN = BIT(10), + /* Executing "doveconf -dF" - add default dovecot_storage_version + setting. */ + CONFIG_PARSE_FLAG_DEFAULT_VERSION = BIT(11), }; /* Used to track changed settings for a setting_parser_info. Initially only diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 64ed3a9951..a87c68a1f4 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -1261,6 +1261,8 @@ int main(int argc, char *argv[]) flags |= CONFIG_PARSE_FLAG_DELAY_ERRORS; if (exec_args == NULL) flags |= CONFIG_PARSE_FLAG_EXTERNAL_HOOKS; + else if (dump_defaults) + flags |= CONFIG_PARSE_FLAG_DEFAULT_VERSION; T_BEGIN { ret = config_parse_file(dump_defaults ? NULL : config_path, flags, have_dump_filter ? &dump_filter : NULL,