Discussion:
Duplicated mails
Knut Anders Hatlen
2015-11-06 22:50:59 UTC
Permalink
Hi,

I've come across a problem with mbsync. I tried to file a bug report, but
the "submit ticket" button in the bug tracker was greyed out for me, so I'm
reporting it here instead.

I use mbsync to sync between a remote Oracle Beehive IMAP server and a
local Dovecot IMAP server. If a new mail is created on the local server,
that mail is copied to the remote server every time mbsync runs, resulting
in multiple copies of the mail message. I'm also seeing this when the local
side is a maildir store instead of a Dovecot server, so I suspect the bug
is in the interaction with the remote server.

I've attached the output from running "mbsync -a --debug-net-all
--debug-main --debug-sync" on a minimized configuration, syncing a local
maildir against the remote IMAP server. (Some folder and host names
redacted.) The logged session copied one mail from the local maildir to the
remote server, even though multiple copies of the mail already exist on the
server.

I used mbsync compiled from the master branch of the git repository to
produce the debug log.

To me it looks like the problem is the response from the server when
9 UID FETCH 8:1000000000 (UID BODY.PEEK[HEADER.FIELDS (X-TUID)])
* 8 FETCH (UID 8 BODY[HEADER.FIELDS ("X-TUID")] {24}
=========
X-tuid: gVqG+EOmudjX
=========
)
9 OK UID FETCH completed
matching just copied messages on master
pair(-2,1): lookup master, TUID gVqG+EOmudjX
-> TUID lost
Warning: lost track of 1 pushed message(s)

mbsync seems to expect the header name to be in all capital letters,
whereas only the first letter of the header name is in uppercase in the
response from the server.

My guess is that parse_fetch_rsp() will have to be changed to do a
case-insensitive check of the response header. That is, the following line
in drv_imap.c needs to do a case-insensitive comparison:

if (starts_with( tmp->val, tmp->len, "X-TUID: ", 8 ))

Just as a quick test, I replaced "X-TUID: " with "X-tuid: " on that line
and recompiled, and then the syncing started behaving as expected. But that
will of course break it for everyone else.


Best regards,
--
Knut Anders
Oswald Buddenhagen
2015-11-06 23:07:08 UTC
Permalink
Post by Knut Anders Hatlen
mbsync seems to expect the header name to be in all capital letters,
whereas only the first letter of the header name is in uppercase in the
response from the server.
this is already fixed in the 1.2 branch, commit 8979ebb.
i need to make a release finally ...

------------------------------------------------------------------------------
Knut Anders Hatlen
2015-11-06 23:20:22 UTC
Permalink
Post by Oswald Buddenhagen
Post by Knut Anders Hatlen
mbsync seems to expect the header name to be in all capital letters,
whereas only the first letter of the header name is in uppercase in the
response from the server.
this is already fixed in the 1.2 branch, commit 8979ebb.
Ah, I missed that the 1.2 branch was newer than master. Yes, seems to work
as expected with head of 1.2. Excellent!
Post by Oswald Buddenhagen
i need to make a release finally ...
Yes, please. :)

Many thanks,
--
Knut Anders
Loading...