Closed Bug 2085116 Opened 29 days ago Closed 10 days ago

Uninitialized moveCopyOpType in nsImapMailFolder::CopyMessagesOffline() when all messages are moved back to their original folder

Categories

(MailNews Core :: Networking: IMAP, defect)

Thunderbird 81
defect

Tracking

(Not tracked)

RESOLVED FIXED
162 Branch

People

(Reporter: michal.dtz, Assigned: welpy-cw)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

In nsImapMailFolder::CopyMessagesOffline(), nsOfflineImapOperationType moveCopyOpType; is only set inside the if (!messageReturningHome) branch
of the message loop (sourceOp->GetOperation(&moveCopyOpType)). When every
message is "returning home" (moved back while offline to the folder it was
moved out of while offline), it is never set, and the uninitialized value is
passed to the nsImapOfflineTxn constructor as the operation type of the undo
transaction. Undo/redo of that transaction then switches on garbage.

Suggested fix: initialize it (e.g. to isMove ? kMsgMoved : kMsgCopy), or
don't record the transaction when srcMsgs is empty.

Steps: go offline, move a message from folder A to B, move it from B back to
A, then undo.

This is very old behavior?

Version: Trunk → Thunderbird 102

Create offline undo transactions only when their header lists are nonempty, avoiding an uninitialized moveCopyOpType read and empty undo entries when all operations are cancelled.

Add regression coverage for cancelled, ordinary, and mixed offline moves with both mbox and maildir stores.

(In reply to Wayne Mery (:wsmwk) from comment #1)

This is very old behavior?

Apparently it's from a regression in Thunderbird 14.0.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 538378
Version: Thunderbird 102 → Thunderbird 81
Assignee: nobody → h.w.forms
Attachment #9672144 - Attachment description: WIP: Bug 2085116 - Skip empty offline IMAP undo transactions. r=#thunderbird-reviewers → Bug 2085116 - Skip empty offline IMAP undo transactions. r=#thunderbird-back-end-reviewers
Status: NEW → ASSIGNED
See Also: → 2089877
Target Milestone: --- → 162 Branch

Pushed by jtracey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/3095bf046ee1
Skip empty offline IMAP undo transactions. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 10 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: