Package: dovecot-sieve
Version: 1:2.4.1+dfsg1-6+deb13u7
Severity: normal
Tags: patch upstream fixed-upstream

Dear Maintainer,

sievec (and the other lib-sieve-tool-based CLI utilities: sieve-test,
sieve-filter, sieve-dump) fails to resolve any Sieve "include" of a
non-personal script type (:global, :before, :after), always reporting
the included script as nonexistent even when correctly configured.
Real mail delivery via dovecot-lda/dovecot-lmtp is NOT affected, only
the CLI tools.

Reproduction:

  # /etc/dovecot/local.conf
  sieve_script personal {
    type = personal
    driver = file
    path = ~/sieve
    active_path = ~/.dovecot.sieve
  }
  sieve_script global {
    type = global
    driver = file
    path = /etc/sieve
  }

  # /home/testuser/.dovecot.sieve
  require ["include"];
  include :global "spam";

  # /etc/sieve/spam.sieve
  require ["fileinto"];
  fileinto "Spam";

  $ sievec -c /etc/dovecot/dovecot.conf /home/testuser/.dovecot.sieve
  .dovecot: line 2: error: included global script 'spam' does not exist.
  sievec: Fatal: failed to compile sieve script

Root cause: sievec registers the script file given on the command line
as a synthetic "sieve_script" entry via settings_override(), using the
filter key "sieve_script" without a "+" suffix. In Dovecot's
settings-override mechanism, a filter-array key without "+" *replaces*
the whole array instead of adding to it, so every other configured
sieve_script block (global/default/personal) gets wiped out the moment
any CLI tool is pointed at a script file.

Already fixed upstream with a one-line commit:

  
https://github.com/dovecot/pigeonhole/commit/c80a52d59a92c139cca481c9af718a2fbfa0ae78

  --- a/src/lib-sieve-tool/sieve-tool.c
  +++ b/src/lib-sieve-tool/sieve-tool.c
  @@ -587,7 +587,7 @@ sieve_tool_script_parse_location(...)
  -       settings_override(set_instance, "sieve_script", storage_name,
  +       settings_override(set_instance, "sieve_script+", storage_name,
                            SETTINGS_OVERRIDE_TYPE_2ND_CLI_PARAM);

Present in Pigeonhole 2.4.2+; I confirmed it's already fixed in
unstable's dovecot-sieve 1:2.4.5+dfsg1-4, and also cherry-picked this
single line onto trixie's 1:2.4.1+dfsg1-6+deb13u7 source with no other
changes and confirmed it resolves the issue there too. Scoped entirely
to the CLI tools' own settings registration, not touching the delivery
path, so should be safe to backport via point release.

This makes sievec/sieve-test actively misleading for any site using
global/before/after scripts via "include", as it confidently reports a
working setup as broken, which sent us on an unnecessary multi-hour
troubleshooting detour before we found the real cause.

It would be great if this could hit a stable update for trixie at some
point.

Thanks for maintaining dovecot-sieve in Debian.

-- System Information:
(fill in with reportbug's auto-collected output from the affected host)

Attachment: signature.asc
Description: PGP signature

Reply via email to