Bug 439518

Summary: Deleting an active sieve script leaves sieve unfunctional (using Dovecot)
Product: [Applications] kmail2 Reporter: Tobias Leupold <tl>
Component: sieveAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal CC: montel, tl
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Tobias Leupold 2021-07-05 14:20:34 UTC
Dear devs,

if I delete a sieve script via KMail's managesieve interface, and the script is active, it leaves sieve unfunctional afterwards.

What's happening is this:

Dovecot creates a USER.sieve script containing all active scripts, e. g.:

    require ["include"];
    
    include :personal "some-script";
    include :personal "some-other-script";

Now if I delete "some-script", it's actually deleted, but USER.sieve is not updated (and still contains 'include :personal "some-script";').

So next time an email is filtered, this happens:

mail log:

    Jul  5 15:20:01 server dovecot: lda(user@domain)<123456>
    <xxxxxxxxxxxxxxxxxxxxxx>: sieve: Failed to compile script 
    `/srv/sieve/user@domain/active-script.sieve' (view user logfile 
    `/srv/sieve/user@domain/active-script.sieve.log' for more information)

active-script.sieve.log:

    sieve: info: started log at Jul 05 14:57:54.
    USER: line 12: error: included personal script 'some_script' does not exist.
    USER: error: validation failed.

So, to avoid this, one has to FIRST deactivate the respectice script, so that USER.sieve is updated and THEN delete the script. Or to manually fix USER.sieve on the server, which is surely not what's intended.

So the question is now: Is this a KMail bug, a Doveceot bug, or is the server misconfigured?!
Comment 1 Laurent Montel 2021-07-15 11:10:42 UTC
I need to make a big change in libksieve for doing it.
It's on my todo list 21.12
Comment 2 Tobias Leupold 2021-07-15 11:14:56 UTC
Nice if this is on the to do list :-)

I also asked the Dovecot mailing list about this problem. The final statement was that handling this correctly is up to the managesieve client.

Thanks in advance for addressing this!