]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH 12/12] config: doveconf -dF - Add dovecot_storage_version
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 9 Apr 2025 11:11:42 +0000 (14:11 +0300)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
Gbp-Pq: Name 0012-config-doveconf-dF-Add-dovecot_storage_version.patch

src/config/config-parser.c
src/config/config-parser.h
src/config/doveconf.c

index dbbe91ed9969e1093370ea5b40add3edbe0bf3e2..f9920da621676f0ca944310e23c9d3b87ca045b6 100644 (file)
@@ -2958,6 +2958,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) :
index f9d70f1be8b46538470d11c40ee0f479a6a879d7..976aedeebec42fc12acfb906d3bce95b8b7f8d38 100644 (file)
@@ -40,6 +40,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
index 825d84545c0223eaff829ca308ae0cd0260e1551..ddc055f1bbf7c15af4d8f2a24b3803549d76cf48 100644 (file)
@@ -1234,6 +1234,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,