NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.49k stars 12.99k forks source link

sieve (dovecot/pigeonhole) script fails after updating #286859

Open jeschmidt opened 5 months ago

jeschmidt commented 5 months ago

Describe the bug

Without changing configuration, I ran nixos-rebuild switch --update on my mail server. Note: I am using the nixos-unstable channel.

Most of my 'sieve' configuration was done using services.dovecot2.extraConfig as there wasn't much native nix config for it, which seems to have changed recently. I had a very basic configuration:

      service managesieve-login {
        inet_listener sieve {
          port = 4190
        }
      }
      service managesieve {
      }
      protocol lda {
        mail_plugins = $mail_plugins sieve
      }
      protocol lmtp {
        mail_plugins = $mail_plugins sieve
      }
      protocol sieve {
      }
      plugin {
        sieve = file:~/sieve;active=~/.dovecot.sieve
      }

And the sieve script itself is very basic also, just moving mail into subfolders based on From address. I won't paste the script for now (it's named "fromfilter" in the below log) but I can if requested. Here's the error I get in .dovecot.sieve.log when every new mail arrives:

sieve: info: started log at 2024-02-06 17:03:33 -0800.
fromfilter: line 5: error: require command: unknown Sieve capability `fileinto'.
fromfilter: line 18: error: unknown command 'fileinto' (only reported once at first occurrence).
fromfilter: error: validation failed.

Which is weird because 'fileinto' is a basic capability of sieve and not a plugin or extension.

Expected behavior

Expected sieve protocol to function as it did previously with the same configuration

Notify maintainers

@2xsaiko I think this might have to do with your recent changes to dovecot.nix?

Metadata

# nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.69, NixOS, 24.05 (Uakari), 24.05pre580425.faf912b08657`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos"`
 - channels(jschmidt): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
dotlambda commented 5 months ago

You have to set

services.dovecot2.sieve.extensions = [ "fileinto" ];

See https://github.com/NixOS/nixpkgs/pull/275031

jeschmidt commented 5 months ago

That fixed it, thanks. And I did a search first but I suppose only in "issues" not pull requests. I'll try harder to find the answers myself in future!

2xsaiko commented 5 months ago

Maybe sieve.extensions should be set to dovecot's default value (haven't checked what that is yet) so you can add to it like in this config.

thomask77 commented 1 month ago

@jeschmidt can you please re-open the bug?

At the moment, if the sieve.extensions option is not set, the module will emit `sieve_extensions ='.

This will disable all extensions, including dovecot's defaults.

In fact, it's enough to enable any extension in sieve.extension - in your case "copy" would have had the same effect as "fileinto". If anything is set, the module will emit "sieve_extensions = +copy": it's keeping the defaults and adds copy.

The correct bug fix would be either:

@RaitoBezarius: Can you have a look? You seem to have introduced those lines in the module.

2xsaiko commented 1 month ago

I actually introduced this initially. Sorry about that! #286184 should get rid of this bad default.