mailing list archives

meli community discussions

⚠️ if something does not work as intended when interracting with the mailing lists,
reach out Github mirror Gitea repo @epilys:matrix.org

E-mail headers
From: Michael Barker <mbarker@buni.org>
To: imap-protocol@u.washington.edu
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: 46581509.7050201@buni.org permalink / raw / eml / mbox
Hi,

I have a question regarding behaviour when multiple clients are 
accessing the same mailbox, especially regarding expunge.  What is the 
appropriate behaviour in the following senario.

C: A001 NOOP
S: * 3 EXISTS
S: * 3 RECENT
S: A001 OK NOOP completed
...Other client expunges message 3...
C: A002 FETCH 1:3 (FLAGS)
S: * 1 FETCH (FLAGS (RECENT))
S: * 2 FETCH (FLAGS (RECENT))
...What happens here?  Do we simply not send information for message 3 
or send a NO response to indicate the message is no longer available?
S: A002 OK FETCH completed

Does the behaviour change if the client sends a wildcard (FETCH 1:* ...) 
instead of an explicit range.

Regards,
Michael Barker.
Reply
E-mail headers
From: tss@iki.fi
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: 1180182602.32181.1919.camel@hurina permalink / raw / eml / mbox
On Sat, 2007-05-26 at 12:07 +0100, Michael Barker wrote:
> I have a question regarding behaviour when multiple clients are 
> accessing the same mailbox, especially regarding expunge.

This is discussed in RFC 2180. Summing up your possibilities:

1. Keep the message around until there are no sessions that see it. This
is the preferred behavior.

2. Give some dummy replies for the message. Such as empty flags, and
other fields being NILs or whatever is legal for the field. The downside
to this is that it violates the IMAP protocol if the client had already
asked something about this message.

3. Don't return the FETCH reply for the message at all and return a
tagged NO reply. Doing this makes some clients ask the same message
range over and over again infinitely. This could be avoided also:
http://mailman1.u.washington.edu/pipermail/imap-protocol/2006-September/000281.html

4. Disconnect the client anytime you can't handle the request. I used to
do this but it was annoying when it happened.

5. Don't allow EXPUNGE until there's only session. I think this is the
worst of the possibilities.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20070526/fcb9da72/attachment.sig>
Reply
E-mail headers
From: mrc@CAC.Washington.EDU
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: alpine.OSX.0.99.0705260804430.3501@pangtzu.panda.com permalink / raw / eml / mbox
Note that the inventor of IMAP disagrees with the very last sentence of 
Timo's message (see below).  He thinks that the preferred order of 
behavior is:
 	(1) which everybody thinks is the best
 	(5) which at least maintains consistant protocol state
 	(4) annoying to users, but doesn't violate protocol state
 	(2)/(3) which mislead some clients, breaks others, and
 	    violates protocol state,

As far as the inventor of IMAP is concerned, (1) and (5) are the ONLY 
acceptable choices.

On Sat, 26 May 2007, Timo Sirainen wrote:
> This is discussed in RFC 2180. Summing up your possibilities:
> 
> 1. Keep the message around until there are no sessions that see it. This
> is the preferred behavior.
> 
> 2. Give some dummy replies for the message. Such as empty flags, and
> other fields being NILs or whatever is legal for the field. The downside
> to this is that it violates the IMAP protocol if the client had already
> asked something about this message.
> 
> 3. Don't return the FETCH reply for the message at all and return a
> tagged NO reply. Doing this makes some clients ask the same message
> range over and over again infinitely. This could be avoided also:
> http://mailman1.u.washington.edu/pipermail/imap-protocol/2006-September/000=
> 281.html
> 
> 4. Disconnect the client anytime you can't handle the request. I used to
> do this but it was annoying when it happened.
> 
> 5. Don't allow EXPUNGE until there's only session. I think this is the
> worst of the possibilities.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
Reply
E-mail headers
From: mbarker@buni.org
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: 1181230565.6639.15.camel@mike-laptop permalink / raw / eml / mbox
On a similar note, what is the preferred behaviour when another client
expunges a mailbox, then new messages are added?  Should the EXISTS
response, indicating new message, be sent straight away or should it
wait until after the server has sent the EXPUNGE response?

Regards,
Michael Barker.

On Sat, 2007-05-26 at 08:09 -0700, Mark Crispin wrote:
> Note that the inventor of IMAP disagrees with the very last sentence of 
> Timo's message (see below).  He thinks that the preferred order of 
> behavior is:
>  	(1) which everybody thinks is the best
>  	(5) which at least maintains consistant protocol state
>  	(4) annoying to users, but doesn't violate protocol state
>  	(2)/(3) which mislead some clients, breaks others, and
>  	    violates protocol state,
> 
> As far as the inventor of IMAP is concerned, (1) and (5) are the ONLY 
> acceptable choices.
> 
> On Sat, 26 May 2007, Timo Sirainen wrote:
> > This is discussed in RFC 2180. Summing up your possibilities:
> > 
> > 1. Keep the message around until there are no sessions that see it. This
> > is the preferred behavior.
> > 
> > 2. Give some dummy replies for the message. Such as empty flags, and
> > other fields being NILs or whatever is legal for the field. The downside
> > to this is that it violates the IMAP protocol if the client had already
> > asked something about this message.
> > 
> > 3. Don't return the FETCH reply for the message at all and return a
> > tagged NO reply. Doing this makes some clients ask the same message
> > range over and over again infinitely. This could be avoided also:
> > http://mailman1.u.washington.edu/pipermail/imap-protocol/2006-September/000=
> > 281.html
> > 
> > 4. Disconnect the client anytime you can't handle the request. I used to
> > do this but it was annoying when it happened.
> > 
> > 5. Don't allow EXPUNGE until there's only session. I think this is the
> > worst of the possibilities.
> 
> -- Mark --
> 
> http://panda.com/mrc
> Democracy is two wolves and a sheep deciding what to eat for lunch.
> Liberty is a well-armed sheep contesting the vote.
Reply
E-mail headers
From: mrc@CAC.Washington.EDU
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: alpine.OSX.0.99.0706070855180.11475@pangtzu.panda.com permalink / raw / eml / mbox
What I think you may be missing is that event reports do not necessarily 
follow the same announcement order as the events occurred.

To elaborate on your example, let's suppose that there are five messages 
in the mailbox.  A session deletes and expunges messages 2 and 4.  Then, 
three new messages are added.

Meanwhile, another client has the mailbox open, and the client does not do 
a command (a NOOP in this example) that announces the expunge until the 
new messages have been delivered.  Here is what that other client will 
see:
 	a001 FETCH ...
 	* n FETCH ...
 	a001 OK FETCH completed
 	a002 FETCH ...
 	* n FETCH ...
 	* 8 EXISTS
 	* 3 RECENT
 	a002 OK FETCH completed
 	a003 NOOP
 	* 2 EXPUNGE
 	* 3 EXPUNGE
 	* 6 EXISTS
 	* 3 RECENT
 	a003 OK NOOP completed

In this example, the expunge happened during command a001, but the 
announcement was deferred since FETCH can not announce EXPUNGE.

The same deferral happened during command a002, but the three new messages 
were noticed.  Note the EXISTS count of 8; the other session probably has 
an EXISTS count of 6 since it successfully expunged, but this one has an 
EXISTS count of 8.  In what I consider to be the correct implementation, 
we can still FETCH the data for those two messages.

Finally, command a003 causes the announcement of the expunge of messages 2 
and 4.  Note that the second EXPUNGE event is for message 3; this is 
because the effect of expunging message 2 is immediate and thus what was 
message 4 becomes message 3.  This is an important point to understand 
IMAP expunge correctly.  If you expunge every message in the mailbox you 
will probably get a lot of "* 1 EXPUNGE"....


On Thu, 7 Jun 2007, Michael Barker wrote:

> On a similar note, what is the preferred behaviour when another client
> expunges a mailbox, then new messages are added?  Should the EXISTS
> response, indicating new message, be sent straight away or should it
> wait until after the server has sent the EXPUNGE response?
>
> Regards,
> Michael Barker.
>
> On Sat, 2007-05-26 at 08:09 -0700, Mark Crispin wrote:
>> Note that the inventor of IMAP disagrees with the very last sentence of
>> Timo's message (see below).  He thinks that the preferred order of
>> behavior is:
>>  	(1) which everybody thinks is the best
>>  	(5) which at least maintains consistant protocol state
>>  	(4) annoying to users, but doesn't violate protocol state
>>  	(2)/(3) which mislead some clients, breaks others, and
>>  	    violates protocol state,
>>
>> As far as the inventor of IMAP is concerned, (1) and (5) are the ONLY
>> acceptable choices.
>>
>> On Sat, 26 May 2007, Timo Sirainen wrote:
>>> This is discussed in RFC 2180. Summing up your possibilities:
>>>
>>> 1. Keep the message around until there are no sessions that see it. This
>>> is the preferred behavior.
>>>
>>> 2. Give some dummy replies for the message. Such as empty flags, and
>>> other fields being NILs or whatever is legal for the field. The downside
>>> to this is that it violates the IMAP protocol if the client had already
>>> asked something about this message.
>>>
>>> 3. Don't return the FETCH reply for the message at all and return a
>>> tagged NO reply. Doing this makes some clients ask the same message
>>> range over and over again infinitely. This could be avoided also:
>>> http://mailman1.u.washington.edu/pipermail/imap-protocol/2006-September/000=
>>> 281.html
>>>
>>> 4. Disconnect the client anytime you can't handle the request. I used to
>>> do this but it was annoying when it happened.
>>>
>>> 5. Don't allow EXPUNGE until there's only session. I think this is the
>>> worst of the possibilities.
>>
>> -- Mark --
>>
>> http://panda.com/mrc
>> Democracy is two wolves and a sheep deciding what to eat for lunch.
>> Liberty is a well-armed sheep contesting the vote.
>
>

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
Reply
E-mail headers
From: guenther+imap@sendmail.com
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: Pine.BSO.4.64.0706071648360.5267@vanye.mho.net permalink / raw / eml / mbox
On Thu, 7 Jun 2007, Mark Crispin wrote:
...
> Here is what that other client will see:
> 	a001 FETCH ...
> 	* n FETCH ...
> 	a001 OK FETCH completed
> 	a002 FETCH ...
> 	* n FETCH ...
> 	* 8 EXISTS
> 	* 3 RECENT
> 	a002 OK FETCH completed
> 	a003 NOOP
> 	* 2 EXPUNGE
> 	* 3 EXPUNGE
> 	* 6 EXISTS
> 	* 3 RECENT
> 	a003 OK NOOP completed

Note that the final EXISTS response is not required here: the previous 
EXISTS said eight and there have been exactly two EXPUNGE responses, so 
the client already knows that exactly six messages remain.  RFC 3501, 
section 7.4.1, p2:
       The EXPUNGE response also decrements the number of messages in the
       mailbox; it is not necessary to send an EXISTS response with the
       new value.

The RECENT response clearly needs to be sent whenever the number messages 
with the \recent flag has changed.  It's probably technically legal to 
suppress it when that count hasn't changed (say, if new messages have 
arrived that aren't \recent or if an equal number of \recent messages have 
been expunged as have arrived), but it may not be wise for a server to do 
that.


Philip GUenther
Reply
E-mail headers
From: MRC@CAC.Washington.EDU
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: alpine.WNT.0.99.0706071610090.3900@Shimo-Tomobiki.Panda.COM permalink / raw / eml / mbox
On Thu, 7 Jun 2007, Philip Guenther wrote:
> Note that the final EXISTS response is not required here: the previous EXISTS 
> said eight and there have been exactly two EXPUNGE responses, so the client 
> already knows that exactly six messages remain.

Correct.  I included that EXISTS solely for clarity.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
Reply
E-mail headers
From: tss@iki.fi
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:39 -0000
Message-ID: 1181489494.5181.1.camel@hurina permalink / raw / eml / mbox
On Thu, 2007-06-07 at 17:02 -0600, Philip Guenther wrote:
> The RECENT response clearly needs to be sent whenever the number messages 
> with the \recent flag has changed.  It's probably technically legal to 
> suppress it when that count hasn't changed (say, if new messages have 
> arrived that aren't \recent or if an equal number of \recent messages have 
> been expunged as have arrived), but it may not be wise for a server to do 
> that.

Dovecot has been doing that for years. Haven't heard any complains yet.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20070610/c420e59b/attachment.sig>
Reply