Mariusz Kruk
2012-Jun-18 13:45 UTC
[Dovecot] Maildir + quota + listescape = wrong dir location
I've just stumbled across a strange thing which seems to be a bug. It happens in 2.0.9 as well as 2.0.11 in which I tested it. dovecot -n output: # 2.0.9: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-220.17.1.el6.x86_64 x86_64 CentOS release 6.2 (Final) listen = * mail_location = maildir:~/mail mail_plugins = " quota listescape" mbox_write_locks = fcntl namespace { inbox = yes location prefix separator = / type = private } passdb { driver = pam } plugin { quota = maildir:User quota quota_rule = *:storage=1G } protocols = imap ssl_cert = </etc/pki/dovecot/certs/dovecot.pem ssl_key = </etc/pki/dovecot/private/dovecot.pem userdb { driver = passwd } protocol imap { mail_plugins = " quota listescape imap_quota autocreate" } The problem with this setup is that with listescape loaded doveadm (as well as dovecot running by itself) can't properly get quotas for nested subfolders. Listescape causes dovecot to use namespace separator for fetching directory names corresponding to folders instead of interpreting them according to layout rules. When I tried stracing, i got this: # strace -e trace=stat doveadm quota recalc -u testimap 2>&1 | grep testimap stat("/home/testimap/mail", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/new", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/cur", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX/test/new", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX/test/cur", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/new", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/cur", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX/test/new", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX/test/cur", 0x7fff220ca290) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 If I either disable listescape or change namespace separator to dot, the path gets resolved correctly (although it's still wrong behaviour with '.' as separator, just happens to give right result in this case). # strace -e trace=stat doveadm quota recalc -u testimap 2>&1 | grep testimap stat("/home/testimap/mail", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/new", 0x7fffac6b0cb0) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/cur", 0x7fffac6b0cb0) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.INBOX.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/new", 0x7fffac6b0cb0) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/cur", 0x7fffac6b0cb0) = -1 ENOENT (No such file or directory) stat("/home/testimap/mail/.INBOX.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.INBOX.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail/.test/cur", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/testimap/mail", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 And in this case quota info gets updated correctly. I believe this is a bug but maybe I'm missing something about listescape configuration. Regards Mariusz Kruk
Timo Sirainen
2012-Jun-18 14:08 UTC
[Dovecot] Maildir + quota + listescape = wrong dir location
On 18.6.2012, at 16.45, Mariusz Kruk wrote:> I've just stumbled across a strange thing which seems to be a bug. > It happens in 2.0.9 as well as 2.0.11 in which I tested it.Listescape has some unfixable problems in v2.0. You've most likely hit one of them. v2.1 had some larger changes and fixes listescape to work perfectly.