On Monday, 24 October 2011 at 08:29, Philippe Meunier wrote: > Hello, > > I'm trying to use mutt (1.5.21 on OpenBSD 4.9) to connect to an IMAP > server. Connection and authentication work fine but then something > goes wrong while fetching message headers: I get a "skipping FETCH > response for unknown message number" error for every message and then > mutt gets stuck and I have to kill it. Here's the log:
thanks. This server ("CrediMail imapserver-2.5") looks pretty broken: ... > [2011-10-24 20:22:00] Selecting INBOX... > [2011-10-24 20:22:00] 4> a0004 SELECT "INBOX" > [2011-10-24 20:22:00] 4< * 12 EXISTS > [2011-10-24 20:22:00] Handling EXISTS > [2011-10-24 20:22:00] cmd_handle_untagged: New mail in INBOX - 12 messages > total. > [2011-10-24 20:22:00] 4< * 3 RECENT > [2011-10-24 20:22:00] 4< * OK [UNSEEN 100028] Message 100028 is first unseen. > [2011-10-24 20:22:00] 4< * OK [UIDVALIDITY 1319410466] UID validity status > [2011-10-24 20:22:00] 4< * OK [UIDNEXT 100028] UIDNEXT > [2011-10-24 20:22:00] 4< * FLAGS (\Deleted \Seen \Recent \Flagged \Draft > \Recent) > [2011-10-24 20:22:00] 4< * OK [PERMANENTFLAGS (\Deleted \Seen \*)] > PermanentFlags > [2011-10-24 20:22:00] 4< a0004 OK [READ-WRITE] SELECT COMPLETED ok. There are 12 messages (3 new) in your inbox, as reported by the server. > [2011-10-24 20:22:00] Fetching message headers... (12) > [2011-10-24 20:22:00] 4> a0005 FETCH 1:12 (UID FLAGS INTERNALDATE > RFC822.SIZE BODY.PEEK[HEADER.FIELDS (DATE FROM SUBJECT TO CC > MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO > REPLY-TO LINES LIST-POST X-LABEL)]) so let's fetch messages 1:12 by sequence number. > [2011-10-24 20:22:01] 4< * 100027 FETCH (UID 100027 FLAGS (\Recent > \Seen) INTERNALDATE "24-Oct-2011 16:23:00 +0900" RFC822.SIZE 39753 > BODY[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES > CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES > LIST-POST X-LABEL)] {312} we're already broken. This mesage reports a sequence number of 100027. That's fine as a UID, but completely wrong as the sequence number. > [2011-10-24 20:22:01] imap_read_literal: reading 312 bytes > [2011-10-24 20:22:01] 4< ) > [2011-10-24 20:22:01] imap_read_headers: skipping FETCH response for unknown > message number 100027 > [2011-10-24 20:22:01] 4< * 100023 FETCH (UID 100023 FLAGS (\Recent \Seen) > INTERNALDATE "24-Oct-2011 11:15:00 +0900" RFC822.SIZE 575722 > BODY[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES > CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST > X-LABEL)] {348} > [2011-10-24 20:22:01] imap_read_literal: reading 348 bytes > [2011-10-24 20:22:01] 4< ) > [2011-10-24 20:22:01] imap_read_headers: skipping FETCH response for unknown > message number 100023 > [... and so on for every message ...] > [2011-10-24 20:22:01] 4< * 100002 FETCH (UID 100002 FLAGS (\Seen) > INTERNALDATE "26-Jul-2011 11:31:00 +0900" RFC822.SIZE 107354 > BODY[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES > CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST > X-LABEL)] {393} > [2011-10-24 20:22:01] imap_read_literal: reading 393 bytes > [2011-10-24 20:22:01] 4< ) > [2011-10-24 20:22:01] imap_read_headers: skipping FETCH response for unknown > message number 100002 > [2011-10-24 20:22:01] 4< * 100001 FETCH (UID 100001 FLAGS (\Seen) > INTERNALDATE "01-Jul-2011 09:50:00 +0900" RFC822.SIZE 26958 > BODY[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES > CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST > X-LABEL)] {357} > [2011-10-24 20:22:01] imap_read_literal: reading 357 bytes > [2011-10-24 20:22:01] 4< ) > [2011-10-24 20:22:01] imap_read_headers: skipping FETCH response for unknown > message number 100001 > [2011-10-24 20:22:01] 4< a0005 OK FETCH COMPLETED. This error is due to the broken sequence numbers, I think. Mutt shouldn't hang at this point (the a0005 OK should terminate the message loop), so that's a bug. But the server is also broken. > At that point mutt gets stuck and the log ends. > > So... anyone has any idea how I might get this to work? > Please note: I have no control over the IMAP server. > > For reference, here's the log from thunderbird, which works fine: Thunderbird is probably fetching by UID. I expect most clients do these days, and that's why the server gets away with being completely broken for sequences. Fixing the hang in mutt should be doable. Getting it to read mail off your server would mean using UID FETCH instead of FETCH, which I suspect will be somewhat invasive. I haven't had time for mutt hacking for a while (nor have the other devs, I believe) so it may be a bit before it's fixed. I'm sorry about that. Please file a bug about this (this email is a good bug report) so we don't lose track of it.