Closed Bug 663761 Opened 9 years ago Closed 9 years ago

keeps redownloading the same messages over IMAP

Categories

(MailNews Core :: Networking: IMAP, defect)

x86
Windows XP
defect
Not set

Tracking

(thunderbird7 fixed)

VERIFIED FIXED
Thunderbird 8.0
Tracking Status
thunderbird7 --- fixed

People

(Reporter: fejes, Assigned: Bienvenu)

Details

(Whiteboard: [has protocol logs])

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

For a long time I've used POP to download my messages. One day I decided to switch to IMAP. I created an IMAP account for the same email address and uploaded all my locally stored messages from the POP account to the IMAP account. Ever since Thunderbird keeps redownloading all my messages. I went as far as deleting all offline mailbox data, but it's still happening. I figure there's something wrong with the headers, so I'll attach a sample. First please tell me what I should do to stop this behavior, then move on to why it happened. I have access to the raw courier files on the server via FTP, so I might even try editing the messages on the server with a script.

Reproducible: Didn't try
I copy-pasted it from the Thunderbird mailbox, so it may not be byte-accurate. You can see three new lines. This may cause the continuous redownloading.
can we get an imap log as described at https://wiki.mozilla.org/MailNews:Logging so we can see what's going on ?
Component: General → Networking: IMAP
Product: Thunderbird → MailNews Core
QA Contact: general → networking.imap
Attached file imap log
When this was made, there were no new messages, I downloaded everything before. I waited until it downloaded around a hundred messages then I quit. I filtered the message bodies and account information, which sadly TB didn't do.
Whiteboard: [has protocol logs]
Attached patch proposed fixSplinter Review
I noticed this happening to a few of my messages, and the all had a "From " line as the first line returned by the imap server. Technically, the imap server shouldn't do that, but mine does, as does the reporter's, so we should just allow it.

I thought about stripping the "From " off in the imap protocol code, but it's best not to remove any of the message content, even if it's not kosher.
Assignee: nobody → dbienvenu
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #544898 - Flags: review?(neil)
Comment on attachment 544898 [details] [diff] [review]
proposed fix

>+          if (findPos != -1 && (startOfMsg[findPos] == ':' ||
>+              !(strncmp(startOfMsg, "From ", 5))))
Indentation is confusing, it makes it look as if you want to check for "From" when findPos is -1, which would be incorrect. Try

if (findPos != -1 && (startOfMsg[findPos] == ':' ||
                      !(strncmp(startOfMsg, "From ", 5))))

Or

if (findPos != -1 &&
    (startOfMsg[findPos] == ':' || !(strncmp(startOfMsg, "From ", 5))))

Or

if (findPos != -1 &&
    (startOfMsg[findPos] == ':' ||
     !(strncmp(startOfMsg, "From ", 5))))
Attachment #544898 - Flags: review?(neil) → review+
fixed in trunk, http://hg.mozilla.org/comm-central/rev/e6a7df2f0c20, with line reformatted to the first option.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 8.0
wouldn't hurt to consider this for tb 7 - it's a simple fix.
I wouldn't mind that either :). Anyway, please tell me when and how you decide so that I can test it.
Comment on attachment 544898 [details] [diff] [review]
proposed fix

Yep, let's take this for 7.
Attachment #544898 - Flags: approval-comm-beta+
Comment on attachment 544898 [details] [diff] [review]
proposed fix

Err, get the right flag this time.
Attachment #544898 - Flags: approval-comm-beta+ → approval-comm-aurora+
fixed for TB 7 - http://hg.mozilla.org/releases/comm-aurora/rev/851aad78b9c6

There are still cases where this will happen, when the server returns a really corrupted message, but those cases should be rarer.
It works for me too, thank you.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.