Commit 3580e1c
committed
midb: process deletions without delay
IMAP clients get really confused if a message is expunged but then reappears
as a supposedly new message, but carrying an old UID.
Suppose the state of the IMAP INBOX is:
```
a fetch 1:* (uid)
* 1 FETCH (UID 2359)
* 2 FETCH (UID 2360)
* 3 FETCH (UID 2361)
* 4 FETCH (UID 2362)
* 5 FETCH (UID 2363)
* 6 FETCH (UID 2364)
* 7 FETCH (UID 2365)
* 8 FETCH (UID 2366)
* 9 FETCH (UID 2367)
* 10 FETCH (UID 2368)
* 10 EXISTS
```
Deleting 1-5 may produce a response like so:
```
```
a store 1:5 +flags \deleted
* 1 FETCH (FLAGS (\Deleted))
* 2 FETCH (FLAGS (\Deleted))
* 3 FETCH (FLAGS (\Deleted))
* 4 FETCH (FLAGS (\Deleted))
* 5 FETCH (FLAGS (\Deleted))
a OK STORE completed
a expunge
* 5 EXPUNGE #uid2363
* 4 EXPUNGE #uid2362
* 3 EXPUNGE #uid2361
* 2 EXPUNGE #uid2360
* 1 EXPUNGE #uid2359
* 8 EXISTS
* 0 RECENT
a OK EXPUNGE completed
```
After the EXPUNGE status lines, the IMAP client view is that INBOX
contains five messages (uids 2364-2368). ``8 EXISTS`` then indicates
that three new messages have come into existence. Per RFC 3501
§2.3.1.1, these must necessarily have higher UIDs >2368. This
condition is violated as a result of midb's delayed M-DELE processing
(the IMAP server's view is as follows):
```
a fetch 1:* (uid)
* 1 FETCH (UID 2361)
* 2 FETCH (UID 2362)
* 3 FETCH (UID 2363)
* 4 FETCH (UID 2364)
* 5 FETCH (UID 2365)
* 6 FETCH (UID 2366)
* 7 FETCH (UID 2367)
* 8 FETCH (UID 2368)
```
References: DESK-3220, DESK-33451 parent c1780c3 commit 3580e1c
2 files changed
+42
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2233 | 2233 | | |
2234 | 2234 | | |
2235 | 2235 | | |
2236 | | - | |
2237 | 2236 | | |
2238 | 2237 | | |
2239 | 2238 | | |
| |||
2244 | 2243 | | |
2245 | 2244 | | |
2246 | 2245 | | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2247 | 2249 | | |
2248 | 2250 | | |
2249 | 2251 | | |
2250 | 2252 | | |
2251 | 2253 | | |
2252 | 2254 | | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
2253 | 2260 | | |
2254 | 2261 | | |
2255 | 2262 | | |
2256 | 2263 | | |
2257 | | - | |
| 2264 | + | |
2258 | 2265 | | |
2259 | 2266 | | |
2260 | 2267 | | |
| |||
2263 | 2270 | | |
2264 | 2271 | | |
2265 | 2272 | | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
2266 | 2298 | | |
| 2299 | + | |
| 2300 | + | |
2267 | 2301 | | |
| 2302 | + | |
2268 | 2303 | | |
2269 | 2304 | | |
2270 | 2305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1281 | 1281 | | |
1282 | 1282 | | |
1283 | 1283 | | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1284 | 1289 | | |
1285 | 1290 | | |
1286 | 1291 | | |
| |||
0 commit comments