[Dovecot] Maildir + quota + listescape = wrong dir location

Mariusz Kruk kruk at epsilon.eu.org
Mon Jun 18 16:45:56 EEST 2012


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


More information about the dovecot mailing list