Opened 2 years ago

Closed 2 years ago

#1487820 closed Bugs (fixed)

Caching problem - Cyrus IMAP - Some emails are not shown

Reported by: yann Owned by:
Priority: 3 Milestone: 0.6-beta
Component: IMAP connection Version: 0.5.1
Severity: major Keywords:
Cc:

Description

Hi,

I upgraded roundcubemail to 0.5.1 and ran into a strange bug.

Some emails are not shown in the message listing when I use no filter, but they are shown when I use "unanswered" filter for example.

Change History (2)

comment:1 Changed 2 years ago by yann

I forgot to mention that this bug disappears when I disable the caching feature.

I investigated this bug and found that it is caused by an incorrect imap response parsing by roundcube.

Here is the communication excerpt between roundcube and the imap server when roundcube asks for the emails list:

[...]
<1299279209<A0006 FETCH 1:* (UID FLAGS)
>1299279209>* 1 FETCH (FLAGS () UID 1)
* 2 FETCH (FLAGS () UID 2)
* 3 FETCH (FLAGS () UID 3)
* 4 FETCH (FLAGS () UID 4)
* 5 FETCH (FLAGS () UID 5)
* 6 FETCH (FLAGS () UID 6)
* 7 FETCH (FLAGS () UID 7)
* 8 FETCH (FLAGS () UID 8)
* 9 FETCH (FLAGS () UID 9)
[...]

roundcube tries to parse the UID using the regexp pattern: '/\((UID|RFC822\.SIZE) ([0-9]+)/'
see: http://trac.roundcube.net/browser/trunk/roundcubemail/program/include/rcube_imap_generic.php#L1347

This doesn't work because UID is not preceded by a '('.

I suppose roundcube expect to receive the information in the same order it asked them (UID first then FLAGS) but it doesn't seem to be the case with Cyrus Imap 2.2.13. I didn't check if this behaviour is RFC compliant.

I changed the pattern with '/(\(|\) )(UID|RFC822\.SIZE) ([0-9]+)/' to be sure to also match if UID is after FLAGS ():

if (preg_match('/(\(|\) )(UID|RFC822\.SIZE) ([0-9]+)/', $line, $matches)) {
  $result[$id] = trim($matches[3]);
} else {
  $result[$id] = 0;
}

comment:2 Changed 2 years ago by alec

  • Component changed from Core functionality to IMAP connection
  • Milestone changed from later to 0.6-beta
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [6a4bccb7].

Note: See TracTickets for help on using tickets.