View Issue Details

IDProjectCategoryView StatusLast Update
0006241SOGoSOPEpublic2026-11-07 04:01
Reporterswallowtail Assigned Toqhivert  
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionopen 
PlatformServerOSRed HatOS Version10
Product Version5.12.10 
Summary0006241: fetchVanished: misses an expunged highest UID when using UID FETCH 1:* against Cyrus IMAP 3.8
Description

I updated from Cyrus IMAP 3.0.7 on RHEL 8 to 3.8.3 on RHEL 10 over the weekend. SOGo runs on a separate RHEL 9 server.

Symptom:
SOGo ActiveSync clients retain a deleted Inbox message when the deleted message was the mailbox's highest live UID. Additions continue to synchronize, SOGo webmail shows the correct mailbox, and independent ActiveSync clients (Nine and Samsung Email) fail identically.

Environment:

  • SOGo and sogo-activesync 5.12.10 (30 August 2026 nightly)
  • SOPE 4.9 from the same nightly
  • Cyrus IMAP 3.8.3
  • QRESYNC/CONDSTORE enabled
  • expunge_mode: delayed and autoexpunge: yes

After expunging the mailbox's highest live UID, Cyrus 3.8 resolves * to the highest UID still present. The expunged UID is therefore outside the requested UID set and is not returned as VANISHED. SOGo advances the collection MODSEQ without generating an ActiveSync Delete, leaving the client entry stale.

This differs from Cyrus 3.0.7. Its _parse_sequence() used state->last_uid as the UID * expansion. Cyrus 3.8.3 instead uses index_getuid(state, state->exists) when messages remain, matching the highest surviving UID. The behavior change exposes SOPE's use of an ambiguous upper bound for vanished messages.

Direct reproduction after expunging the highest UID:

UID FETCH 1:* (UID) (CHANGEDSINCE <previous-modseq> VANISHED)

does not return the expunged UID, while both of these do:

UID FETCH 1:<UIDNEXT-1> (UID) (CHANGEDSINCE <previous-modseq> VANISHED)
UID FETCH 1:4294967295 (UID) (CHANGEDSINCE <previous-modseq> VANISHED)

Proposed one-line fix:

diff

  • @"UID FETCH 1:* (UID) (CHANGEDSINCE %llu VANISHED)",
  • @"UID FETCH 1:4294967295 (UID) (CHANGEDSINCE %llu VANISHED)",

The full UID range avoids * changing after the highest UID is expunged.

Validation: we packaged this change in a local fix. A disposable message was confirmed visible in SOGo, Nine and Samsung before deletion. SOGo deleted it; Cyrus reported the allocated UID absent, no live \Deleted records, and an advanced HIGHESTMODSEQ. Both ActiveSync clients then removed the message by normal refresh without resetting the folder or account.

Steps To Reproduce

See above

TagsNo tags attached.

Activities

swallowtail

swallowtail

2026-08-30 23:10

reporter  

sope_patch.txt (875 bytes)   
--- a/sope-mime/NGImap4/NGImap4Client.m
+++ b/sope-mime/NGImap4/NGImap4Client.m
@@ -1254,8 +1254,14 @@ static NSMutableDictionary *namespaces;

   pool = [[NSAutoreleasePool alloc] init];

+  /*
+   * Do not use "*" as the upper UID bound here.  RFC-compliant servers may
+   * resolve it to the highest message still present, which excludes an
+   * expunged message when that message had the mailbox's highest UID.  The
+   * complete legal UID range ensures VANISHED reports that deletion.
+   */
   cmd  = [NSString stringWithFormat:
-                     @"UID FETCH 1:* (UID) (CHANGEDSINCE %llu VANISHED)",
+                     @"UID FETCH 1:4294967295 (UID) (CHANGEDSINCE %llu VANISHED)",
                    (unsigned long long)_modseq];
   fetchres = [self processCommand:cmd];
   result   = [[self->normer normalizeFetchResponse:fetchres] retain];
sope_patch.txt (875 bytes)   
qhivert

qhivert

2026-09-01 08:02

administrator   ~0018533

Hello!
So, you agree with this PR -> https://github.com/Alinto/sope/pull/73 ?

swallowtail

swallowtail

2026-09-01 13:51

reporter   ~0018534

I searched here, missed that at github! Yes, agree.

swallowtail

swallowtail

2026-09-01 13:56

reporter   ~0018535

I note from the linked PR's link to Cyrus that Cyrus are fixing the underlying cause in 3.13.x... but addressing it in SOPE will allow for older versions of Cyrus to not break mail sync across multiple devices.

swallowtail

swallowtail

2026-11-04 10:12

reporter   ~0018598

3 versions later (5.12.13) I'm still having to manually package and apply the IMAP fix. This is a very simple fix - can it please be released soon?

qhivert

qhivert

2026-11-06 15:27

administrator   ~0018605

Last edited: 2026-11-06 15:29

Hello looking at the PR it looks like it was fixed on cyrus side?
https://github.com/cyrusimap/cyrus-imapd/issues/6071

swallowtail

swallowtail

2026-11-07 04:01

reporter   ~0018606

Only the 3.13.* Cyrus branch has had the patch applied. Red Hat 10 runs 3.8.3, with security fixes backported if needed but this fix is not in there. Cyrus migration paths from 3.8 to 3.13 would be very significant. I'd rather keep applying a packaged fix if that was the choice.

So my choice is really to either keep doing what I am doing now - every time SOGo releases, I repackage the fix, unpin dnf, install SOGo with repackaged fix - or to move that process and apply the fix to Cyrus instead, which is more release-stable than SOPE/SOGo, and unpin my fix from SOPE.

Either way, repackaging installing and living with it is not horrendous, it's just inconvenient. I'm doing it in SOPE because I've proven that it works there.

It seems like the proper "fix" would be to have both SOPE and Cyrus fix it, which would then capture every scenario/version combination. It seems like it would be a simple fix to package into SOPE, that is my point I guess. Does SOGo 6 have the same issue?

But hey, I recognise that we get this for free - so whatever happens, I am thankful.

Issue History

Date Modified Username Field Change
2026-08-30 23:10 swallowtail New Issue
2026-08-30 23:10 swallowtail File Added: sope_patch.txt
2026-09-01 08:02 qhivert Note Added: 0018533
2026-09-01 08:03 qhivert Assigned To => qhivert
2026-09-01 08:03 qhivert Status new => feedback
2026-09-01 13:51 swallowtail Note Added: 0018534
2026-09-01 13:51 swallowtail Status feedback => assigned
2026-09-01 13:56 swallowtail Note Added: 0018535
2026-11-04 10:12 swallowtail Note Added: 0018598
2026-11-06 15:27 qhivert Note Added: 0018605
2026-11-06 15:27 qhivert Status assigned => feedback
2026-11-06 15:29 qhivert Note Edited: 0018605
2026-11-07 04:01 swallowtail Note Added: 0018606
2026-11-07 04:01 swallowtail Status feedback => assigned