Hello,

I've solved it. The compiled sieve script had the same mtime as the
uncompiled script. Dovecot used "<" to see if compilation is needed. It
has to be "<=".

If you wonder why the mtime is the same, I write and compile the sieve
script right after each other automated. Apparently mtime doesn't have a
good resolution in time...

Patch to dovecot-sieve-1.1.4 is attached, can it be included?

Thanks,

Alexander

Alexander Prinsier wrote:
> I should have mentioned I'm running dovecot 1.1.rc3
> 
> Alexander
> 
> Alexander Prinsier wrote:
>> Hello,
>>
>> I'm trying to setup dovecot with sieve support in a way where all sieve
>> scripts are precompiled. All sieve scripts are in /var/cache/sieve/.
>>
>> I believe I discovered a bug here. I describe below how to reproduce it.
>>
>> Dovecot and the user that deliver runs as do not have write permission
>> in /var/cache/sieve/.
>>
>> h01:/var/cache/sieve# ls -la
>> total 16
>> drwxr-xr-x  2 ecp  ecp  4096 Mar 31 21:32 .
>> drwxr-xr-x 10 root root 4096 Mar 31 20:14 ..
>> -rw-r--r--  1 ecp  ecp    88 Mar 31 21:32 [EMAIL PROTECTED]
>> -rw-r--r--  1 ecp  ecp   132 Mar 31 21:32 [EMAIL PROTECTED]
>>
>> When deliver runs it logs this error:
>>
>> open(/var/cache/sieve/[EMAIL PROTECTED]) failed:
>> Permission denied
>>
>> This indicates deliver tries to compile the script, even though the
>> compiled version already is there.
>>
>> To verify I tested another case. I make the compiled script immutable
>> and I did a chmod 777 on /var/cache/sieve/. Then deliver logs this error:
>>
>> rename(/var/cache/sieve/[EMAIL PROTECTED],
>> /var/cache/sieve/[EMAIL PROTECTED]) failed: Operation not
>> permitted
>>
>> And deliver created the file [EMAIL PROTECTED]
>>
>> Some relevant pieces of my dovecot.conf:
>>
>> protocol lda {
>>      mail_plugins = quota cmusieve
>>      ...
>> }
>>
>> plugin {
>>      sieve = /var/cache/sieve/%u.sieve
>> }
>>
>> Anyone can help me? Is this an error on my end, or really a bug?
>>
>> Alexander
>>
> 
> 

--- dovecot-sieve-1.1.4.orig/src/sieve-cmu.c    2008-02-16 19:24:51.000000000 
+0100
+++ dovecot-sieve-1.1.4/src/sieve-cmu.c 2008-04-01 11:30:24.000000000 +0200
@@ -869,7 +869,7 @@ dovecot_sieve_compile(script_data_t *sda
                        return -1;
                }
        } else {
-               if (st.st_mtime < st2.st_mtime)
+               if (st.st_mtime <= st2.st_mtime)
                        return 1;
        }
 

Reply via email to