>>>>> "James" == James Cook via dovecot <dovecot@dovecot.org> writes:

> Moving mail files between Maildir mailboxes often confuses doveadm
> sync: I end up with copies in both the original and new maildir.
> Exact details and script to reproduce follow.

Are you accessing your Maildir from both a mail client, as well as
using IMAP/POP through doveadm?  I would say that this is your
problem.  You should (probably) be only using one method or another.  

> I can work around this by running doveadm move, but it does not fit
> well with my workflow, which is based on paths to mail files (using
> mblaze as my mail client).

Yeah, so mblaze is a bunch of utilities for interacting with Maildir
files.  So since you're screwing around with them behind dovecot's
back, of course you're going to see problems.  So don't do that!

> Two questions:

> 1. Is there anything I can do to help dovecot notice the moves,
> other than using doveadm move instead of just mv? I have tried
> liberal use of force-resync but the problem is still there.

> 2. Is this a bug?

No, you're just using it wrong.  

> Details:

> OS: OpenBSD current

> $ dovecot --version
> 2.3.21.1 (d492236fa0)

> config: My repro script below uses a one-line config, only setting 
> mail_location.

> (An OpenBSD 7.5 server running Dovecot 2.3.21 is involved in my
> real setup, but I was able to reproduce it locally without the
> server involved.)

> To reproduce:
> (shell script follows)
> - Make two maildirs "a" and "b", each with a subfolder ".Archive".
> - Manually write a mail file to a/cur.
> - doveadm sync
> - force-resync everything
> - manually move the file to a/.Archive/cur
> - force-resync everything again
> - doveadm sync
> - Now the mail file appears four times: in a, a/.Archive, b, and b/.Archive.

> Script to do the above follows my signature.

> -- 
> James


> #!/bin/sh
> set -e

> # Run in a new directory with two maildirs named a and b and a simple config.
> mkdir bug; cd bug
> mkdir -p {a,b}/{,.Archive/}{cur,new,tmp}
> cat > dovecot.conf <<EOF
> mail_location=maildir:$PWD/a
> EOF

> # Deliver an email and sync.
> EXAMPLE_ID=12345.R67890.example.com
> cat > a/cur/$EXAMPLE_ID:2, <<EOF
> some email
> EOF
> doveadm -c dovecot.conf sync maildir:b

> # Move the email and sync again. Run force-resync between steps in case it 
> helps.
> doveadm -c dovecot.conf force-resync INBOX
> doveadm -c dovecot.conf force-resync Archive
> doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync INBOX
> doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync Archive
> mv a/cur/$EXAMPLE_ID* a/.Archive/cur
> doveadm -c dovecot.conf force-resync INBOX
> doveadm -c dovecot.conf force-resync Archive
> doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync INBOX
> doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync Archive
> doveadm -c dovecot.conf sync maildir:b

> echo in a:
> doveadm -c dovecot.conf -fflow fetch 'mailbox guid' all
> echo
> echo in b:
> doveadm -c dovecot.conf -fflow -o mail_location=maildir:$PWD/b fetch 'mailbox 
> guid' all
> _______________________________________________
> dovecot mailing list -- dovecot@dovecot.org
> To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to