[Gmail] realdelete considered harmful (was: inbox label not removed when saving to a gmail folder)

Sebastian Spaeth Sebastian at SSpaeth.de
Sat Jan 7 23:56:15 GMT 2012

This mail contains an analysis of Gmail's IMAP behavior, concluding that
realdelete is evil (it predates my time).

On Tue, 6 Dec 2011 11:25:54 +0100, Hans Lambermont <hans at shapeways.com> wrote:
> Sebastian wrote on 2011-12-01:
> > Hans wrote on 20111123:
> ...
> >> How to remove the inbox label when saving to another folder ?
> > 
> > Gmail is a weird thing and other are better qualified to comment on
> > that. If you save a message to a different folder, it merely adds that
> > "tag" to the message, so a mail in gmail happily exists in multiple
> > folders at the same time...
> Yes, what I see is this: in the MUA (mutt) I save a mail to a folder
> (basic Maildir), this works as expected (the mail is no longer in the
> Inbox and sits in the folder), then offlineimap (I use 6.3.3-3ubuntu1)
> syncs with Gmail. On the Maildir side I see no changes (good) but on
> Gmail's web interface I see the mail in the Trash folder with 3 labels :
> Inbox, Trash and the folder I saved to.

OK, here is the thing. It really boils down to Gmails weird handling of
tags and an unsafe option of ours, I believe.

A folder move is internally implemented as a) delete from FOLD1 b) add
to  FOLD2. The order in which 1 or 2 happens could differ depending on
the order in which we sync our folders. 

*IF* you have the option "realdelete=True" set (which I suspect you
have). Then operation "a)" will move the msg from FOLD1 to TRASH which
will internally cause it to lose all tags, ie it *disappears* from all
folders. (Even the "All Mail" thing)

Then, in operation "b)" you upload the MSG2 to FOLD2. This will cause the
msg at the GMail side to 1) Dissappear from TRASH 2) appear in FOLD2 and
3) appear in INBOX (as it is a new msg for Gmail).

It is even worse if we first happen to sync FOLD2 and then FOLD1, in
this case, "b)" will add the folder to Gmail's FOLD2 and "a)" will
move it to FOLD1, which will cause it to disappear from ALL folders
(including FOLD2 that we just added the msg to). In effect it ends up
only in Trash. This is outright data loss...

This is just the weird way Gmail folders behave, combined with the
"realdelete" option, which causes this behavior. I don't see *any* way
we can work around that without turning "realdelete" off. I will add a
note to the docs about its dangerous behaviour.

If you set "realdelete=False" (or delete it), does it still behave this
way? It should work just fine then, it should just keep all mails in "All
Mails" (unless they are moved to Gmail's Trash folder.

I don't think we can do a lot, except telling people to a) not use
realdelete (disable it as I cannot see its positive use) and b) to
always move files into the Gmail/Trash folder if they want to have a
mail really disappear from their "All Mail" box.

PS. Use the latest version of OLI
, 6.4.x has possible flaws.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20120108/2d1ff963/attachment.sig>

More information about the OfflineIMAP-project mailing list