Re: [imap5] Comments on draft-gulbrandsen-imap-move-01

Bron Gondwana <brong@fastmail.fm> Fri, 01 June 2012 22:14 UTC

Return-Path: <brong@fastmail.fm>
X-Original-To: imap5@ietfa.amsl.com
Delivered-To: imap5@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B26BA11E80E2 for <imap5@ietfa.amsl.com>; Fri, 1 Jun 2012 15:14:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.299
X-Spam-Level:
X-Spam-Status: No, score=-3.299 tagged_above=-999 required=5 tests=[AWL=0.300, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R7evWtofFyxj for <imap5@ietfa.amsl.com>; Fri, 1 Jun 2012 15:14:09 -0700 (PDT)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by ietfa.amsl.com (Postfix) with ESMTP id A959A11E80C0 for <imap5@ietf.org>; Fri, 1 Jun 2012 15:14:09 -0700 (PDT)
Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 5C4E521297; Fri, 1 Jun 2012 18:14:09 -0400 (EDT)
Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 01 Jun 2012 18:14:09 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=mesmtp; bh=vrCkzJjVI7LntHXCipnE64eQimc=; b=ooM6f7ig4tUO/R3bmXIhI+NuvBth HMJLk12K09u4OK0jm5v/aji1diUxy6T4z3DQVLeaTMJ/wY6Q6UtUjp9t0n51Tr0T 1KGHz0562iwgDWmqAWY+wVQD9kJvZY1bgZMeazXviRgHEnFw6RFtGdj040wjMVTN 2N2fOSRo4vebaxw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=smtpout; bh=vrCkzJjVI7LntHXCipnE64eQimc=; b=RBpl p8AwDPvVznKziH9AjUynomjTzRq7xIh4yNXj9UcjSdeX41Srk5vYvdBTPHOEfX3J lFBi3dLdYBvzdBvnL7xKQjWfRufHV7mUpL1nYhoesfGL369lS/gjEFRdr3SuqP4x PBhZ0CUTl4cxiZr+xqXs/NFk+zohr98bcrIg3wQ=
X-Sasl-enc: QNCWdMFUCJGoYM0gk7Xm2IR23IN+XObF6oIfBprriUBp 1338588848
Received: from localhost (unknown [31.45.20.151]) by mail.messagingengine.com (Postfix) with ESMTPA id E41FF8E01B6; Fri, 1 Jun 2012 18:14:08 -0400 (EDT)
Received: by localhost (Postfix, from userid 1000) id 64FB77E00BC; Sat, 2 Jun 2012 00:14:09 +0200 (CEST)
Date: Sat, 02 Jun 2012 00:14:09 +0200
From: Bron Gondwana <brong@fastmail.fm>
To: Cyrus Daboo <cyrus@daboo.name>
Message-ID: <20120601221409.GA598@launde.brong.net>
References: <7EF71BCD5999FCCF89A1E22D@caldav.corp.apple.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <7EF71BCD5999FCCF89A1E22D@caldav.corp.apple.com>
Organization: brong.net
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: imap5@ietf.org
Subject: Re: [imap5] Comments on draft-gulbrandsen-imap-move-01
X-BeenThere: imap5@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Discussion on drastically slimming-down IMAP." <imap5.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/imap5>, <mailto:imap5-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/imap5>
List-Post: <mailto:imap5@ietf.org>
List-Help: <mailto:imap5-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/imap5>, <mailto:imap5-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Jun 2012 22:14:10 -0000

On Thu, May 31, 2012 at 10:20:12AM -0400, Cyrus Daboo wrote:
> - §2: what is the problem with sequence MOVE and EXPUNGE? For what
> it is worth Mulberry has always preferred sequence over uids when
> online (it uses UID commands when doing disconnected play back).
> That said, mapping to uids is no big deal (and should not be a big
> deal for any other client that might use sequence in normal
> operation).

Yeah, I don't see a problem either.  I see that my implementation
supports both just fine.  Sequence based moves are handy when you're
fiddling around by hand, if nothing else.

> - §3, ¶4: states that \Deleted must not be set in the target
> mailbox. But what if the messages being moved already had \Deleted
> set prior to the move? Shouldn't we just state that the
> flag/keywords prior to the move must be set on the messages in the
> target mailbox?

That's a really good catch.  Agree with your interpretation
absolutely.  Should be copied with exactly the same flags.

The only potentially sticking point here is awful things like
non-shared \Seen state.  Cyrus (the IMAP server, yay for namespaces)
has per-user seen state.  The actual behaviour at the moment would
be that the owners' \Seen state always gets copied, nobody else's
does.  It might also make sense to copy your OWN \Seen state if you
are not the owner.

But basically it's fluff wording.  The final result shall be as if
COPY + STORE + UID EXPUNGE had happened in precisely that order.
In other words "the messages in the destination mailbox must not
show any state that would not have happened if COPY had been used
instead of MOVE".  The only difference between COPY and MOVE is the
eventual state of the source folder.
 
> - §3: As already mentioned, EXPUNGE responses need to be present.
> Might be worth pointing out that there could be a * EXPUNGE for a
> message not being moved, but which got expunged in another session.
> Actually, more complicated is the case where a message being moved
> was expunged in another session - presumably that message is not
> moved? Yet it would get reported in a * EXPUNGE, but not be part of
> the COPYUID set.

There's no other choice here.  The only rule is that the STORE and
UID EXPUNGE only happen to the messages which were successfully
copied.

Which leads to this interesting little thing.  Two sessions, S1 and S2.

S1: SELECT AFolder
S2: SELECT AFolder
S1: STORE 3 +Flags \Deleted
S2: MOVE 1:5 OtherFolder
S1: EXPUNGE

S1 will see 5 expunges, including the one it was expecting.  S2 will
see the 5 expunged it was expecting as well - but will store the message
as \Deleted in OtherFolder.

I wonder indeed if that was an intention in the spec, that \Deleted gets
explicitly CLEARED by the MOVE operation.  Which is kind of surprising
actually.  Hmm, I wonder.

Yep - COPY copies messages with \Deleted and they have \Deleted in the
destination folder as well.

OK - I take it back, this isn't surprising.  This is the natural way
it should be.  Yes, S1's expunge missed the mark - but that's the
unfortunately downside of two-stage EXPUNGE.  There is literally no
way to avoid this... whenever you do a COPY or MOVE you need to check
your destination messages to make sure you didn't pick up something
half way through being deleted.  Even S1 doing UID EXPUNGE wouldn't
avoid this.

BUT - even if there are other \Deleted messages in the folder, the
"EXPUNGE" part of MOVE never deletes them.  It's a "UID EXPUNGE" on
just the UIDs which were actually affected by this message.  Which
also gives it the dubious honour of including "ERASE".

"ERASE" of course being just the "STORE" and "UID EXPUNGE" parts of the
above command combined together atomically(ish) such that you don't
get the race condition listed above.  In fact it would be atomic in
Cyrus.  I think I'm going to implement this one now in fact, we would
use it immediately.  Er, I'm going to write a separate email for it too.


> - §4: whilst no one may implement it, there still ought to be a
> reference to the interaction with ANNOTATE. ANNOTATE §4.6 has
> detailed text on the interaction with COPY and something similar is
> needed for MOVE.

"As Above" ;)  Literally, it should be enough to say "ANNOTATions
are treated exactly as specified for COPY and for EXPUNGE".