Fatal error with IMAP MOVE from a shared mailbox to Trash folder

Aki Tuomi aki.tuomi at dovecot.fi
Tue Jan 3 22:14:49 UTC 2017



On 12/27/2016 06:35 PM, Daniele Barresi wrote:
> Hello everyone.
> I have a problem using Dovecot 2.2.26 with ACL plugin and deleting e-mails
> from a shared mailbox.
>
> My user doesn't have the "expunge" permission on the shared mailbox, but it
> has the "write-deleted" permission. So, when I delete a message from the
> shared mailbox using a client that implements the IMAP MOVE command, it
> tries to move the message to my Trash folder. Then the server closes the
> connection to the client (process aborted) and I get three lines in the log
> file with a backtrace and "Fatal" error. In this case the message doesn't
> get copied or moved from the shared folder and the client complaints. I
> found the same thing happens whenever I try to move anything between
> folders of the shared mailbox itself, while logged in with my user. I can
> move messages inside my own mailbox just fine.
>
> If I try the same operation from a client that uses the IMAP COPY + DELETE
> commands, no errors are logged and the outcome is as expected: the message
> gets copied from the shared folder to my Trash and gets the flag "\Deleted"
> set on the shared folder.
>
> My setup is as follows:
>
>    Dovecot: 2.2.26.0
>    OS: Ubuntu 16.04.1 LTS
>    CPU architecture: x86_64
>    Filesystem: ext4
>
>
> The relevant lines from mail.err log:
>
> Dec 27 15:21:18 dovecot dovecot: imap(danielebarresi): Panic: file
> mail-storage.c: line 2143 (mailbox_save_context_reset): assertion failed:
> (ctx->copying_via_save)
> Dec 27 15:21:18 dovecot dovecot: imap(danielebarresi): Error: Raw
> backtrace: /usr/lib/dovecot/libdovecot.so.0(+0x9438e) [0x7fbcd478538e] ->
> /usr/lib/dovecot/libdovecot.so.0(+0x9447c) [0x7fbcd478547c] ->
> /usr/lib/dovecot/libdovecot.so.0(i_fatal+0) [0x7fbcd471ea4e] ->
> /usr/lib/dovecot/libdovecot-storage.so.0(+0x41b78) [0x7fbcd4a50b78] ->
> /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_save_cancel+0x73)
> [0x7fbcd4a53d73] -> /usr/lib/dovecot/modules/lib01_acl_plugin.so(+0xe142)
> [0x7fbcd3f1d142] -> /usr/lib/dovecot/libdovecot-storage.so.0(+0x4516d)
> [0x7fbcd4a5416d] ->
> /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_move+0x23)
> [0x7fbcd4a54333] -> dovecot/imap(+0xf9c5) [0x557cf98629c5] ->
> dovecot/imap(command_exec+0xa6) [0x557cf986f196] -> dovecot/imap(+0x1a4c2)
> [0x557cf986d4c2] -> dovecot/imap(+0x1a550) [0x557cf986d550] ->
> dovecot/imap(client_handle_input+0x195) [0x557cf986d915] ->
> dovecot/imap(client_input+0x85) [0x557cf986de25] ->
> /usr/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x4c) [0x7fbcd4799bdc] ->
> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0x10a)
> [0x7fbcd479b09a] ->
> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x25) [0x7fbcd4799c65]
> -> /usr/lib/dovecot/libdovecot.so.0(io_loop_run+0x38) [0x7fbcd4799e08] ->
> /usr/lib/dovecot/libdovecot.so.0(master_service_run+0x13) [0x7fbcd4724f53]
> -> dovecot/imap(main+0x322) [0x557cf9860ca2] ->
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fbcd4348830] ->
> dovecot/imap(+0xde1f) [0x557cf9860e1f]
> Dec 27 15:21:18 dovecot dovecot: imap(danielebarresi): Fatal: master:
> service(imap): child 6907 killed with signal 6 (core dumped)
>
>
> Dovecot configuration (doveadm -n):
>
> # 2.2.26.0 (23d1de6): /etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.16 (fed8554)
> # OS: Linux 4.4.0-57-generic x86_64 Ubuntu 16.04.1 LTS
> auth_cache_negative_ttl = 10 mins
> auth_cache_size = 2 M
> auth_master_user_separator = *
> auth_mechanisms = plain login
> first_valid_uid = 12
> last_valid_uid = 12
> mail_location = maildir:~/Maildir
> mail_plugins = acl quota notify mail_log stats lazy_expunge
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character
> vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
> copy include variables body enotify environment mailbox date index ihave
> duplicate mime foreverypart extracttext
> namespace casellecondivise {
>    list = children
>    location = maildir:%%h/Maildir:INDEXPVT=~/Maildir/shared/%%u
>    prefix = Caselle condivise/%%u/
>    separator = /
>    subscriptions = no
>    type = shared
> }
> namespace expunged {
>    hidden = yes
>    list = no
>    location = maildir:/var/expunged/%n/Expunged
>    prefix = EXPUNGED/
>    separator = /
> }
> namespace inbox {
>    inbox = yes
>    location =
>    mailbox Archive {
>      auto = subscribe
>      special_use = \Archive
>    }
>    mailbox Drafts {
>      auto = subscribe
>      special_use = \Drafts
>    }
>    mailbox Junk {
>      auto = subscribe
>      special_use = \Junk
>    }
>    mailbox Sent {
>      auto = subscribe
>      special_use = \Sent
>    }
>    mailbox Trash {
>      auto = subscribe
>      special_use = \Trash
>    }
>    prefix =
>    separator = /
>    type = private
> }
> passdb {
>    args = /etc/dovecot/dovecot-ldap.conf.ext
>    driver = ldap
> }
> plugin {
>    acl = vfile:/etc/dovecot/global-acls:cache_secs=300
>    acl_shared_dict = file:/etc/dovecot/shared/shared-mailboxes
>    lazy_expunge = EXPUNGED/
>    lazy_expunge_only_last_instance = yes
>    mail_log_events = delete copy flag_change save undelete expunge
>    mail_log_fields = uid box msgid size
>    quota = maildir:user quota
>    quota_exceeded_message = (Quota exceeded) La casella di posta elettronica
> del destinatario è piena.
>    quota_rule = *:storage=1G
>    quota_rule2 = Trash:storage=+100M
>    quota_warning = storage=95%% quota-warning 95 %u
>    quota_warning2 = storage=100%% quota-warning 100 %u
>    sieve = file:~/sieve;active=~/.dovecot.sieve
>    stats_command_min_time = 1 mins
>    stats_domain_min_time = 12 hours
>    stats_ip_min_time = 12 hours
>    stats_memory_limit = 32 M
>    stats_refresh = 30 secs
>    stats_session_min_time = 15 mins
>    stats_track_cmds = yes
>    stats_user_min_time = 1 hours
> }
> protocols = " imap sieve"
> service auth {
>    unix_listener /var/spool/postfix/private/auth {
>      group = mail
>      mode = 0666
>      user = postfix
>    }
>    unix_listener auth-userdb {
>      group = mail
>      user = mail
>    }
> }
> service dict {
>    unix_listener dict {
>      group = mail
>      mode = 0600
>      user = mail
>    }
> }
> service imap-login {
>    process_limit = 300
>    process_min_avail = 2
> }
> service managesieve-login {
>    inet_listener sieve {
>      port = 4190
>    }
> }
> service quota-warning {
>    executable = script /etc/dovecot/scripts/quota-warning.sh
>    unix_listener quota-warning {
>      group = mail
>      user = mail
>    }
> }
> service stats {
>    fifo_listener stats-mail {
>      mode = 0600
>      user = mail
>    }
> }
> ssl = required
> ssl_cert = </etc/ssl/certs/pac.apg23.org.pem
> ssl_key =  # hidden, use -P to show it
> userdb {
>    args = /etc/dovecot/dovecot-sql.conf.ext
>    default_fields = uid=mail gid=mail home=/var/mail/%u master_user=%u
>    driver = sql
> }
> userdb {
>    args = /etc/dovecot/dovecot-ldap.conf.ext
>    default_fields = uid=mail gid=mail home=/var/mail/%u master_user=%u
>    driver = ldap
> }
> protocol lda {
>    mail_plugins = acl quota notify mail_log stats lazy_expunge sieve
> }
> protocol imap {
>    mail_max_userip_connections = 25
>    mail_plugins = acl quota notify mail_log stats lazy_expunge imap_quota
> imap_stats
> }
>
> I tested this with different users with the same result.
> I tested and reproduced the error with Thunderbird and Roundcube.
> The Apple Mail client uses IMAP COPY + DELETE, instead of IMAP MOVE, and no
> errors are reported. So I think it's related to the IMAP MOVE
> implementation on Dovecot server.
>
>
> Has anyone seen the same error?
> Any suggestions? Is this a Dovecot bug?
>
> ---
> Daniele Barresi
Hi!

We'll open a bug on this. Thanks for reporting it.

Aki


More information about the dovecot mailing list