Wrong sorting - please help me debug this
lists at pingle.org
Mon Jul 24 18:17:31 CEST 2006
Jim Pingle wrote:
>> Mark Edwards wrote:
>> Incidentally, Squirrelmail doesn't have the problem. Same server, same mailbox. Squirrelmail has server-side sorting enabled. Roundcube sorts all out of order, Squirrelmail gets it right.
>> This is with Cyrus 2.2.
> I suppose someone may have to tcpdump the interaction between the IMAP
> server and both squirrelmail and roundcube to look for differences in the
> requests. That, or dig through the IMAP library source code.
I hate to reply to myself, but I was checking into this when I discovered
that with server-side sorting enabled, Squirrelmail gets it wrong for me.
With server-side sorting off, it sorts properly.
A tcpdump of the IMAP sessions of both shows that Squirrelmail is sorting
using ARRIVAL and Roundcube is sorting using DATE. Also, Squirrelmail is
supplying an encoding type to the server of "ISO-8859-1" whereas Roundcube
is sending "US-ASCII" in the same situation.
Checking the code of Squirrelmail shows that if you have the personal option
"Sort by Received Date" set to yes, it sends ARRIVAL to the server as the
sort choice, whereas if you have it set to no, it sends DATE. When I was
testing, the option was set to Yes; When I changed it to No, it sorted as
There appears to be support for a similar option in the code for roundcube
(in imap.inc), but I see no method for a user/admin to set it. In
rcube_imap.inc it's explicitly set off, but at the start of imap.inc it is
set on. It tests to see if IMAP_USE_HEADER_DATE is false which it always
will be as I can't find any other reference to the variable it's testing for
anywhere in the code.
As an experiment you could try commenting out line 57 in program/lib/imap.inc:
if (!$IMAP_USE_HEADER_DATE) $IMAP_USE_INTERNAL_DATE = true;
Alternately, change that so it's set to false instead of true.
If it alters the sorting behavior for you, we may have found the culprit...
More information about the Dev