Closed Bug 234935 Opened 21 years ago Closed 14 years ago

Label is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system (tag)

Categories

(MailNews Core :: Database, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED
Thunderbird 3.3a1

People

(Reporter: ch.ey, Assigned: aceman)

References

(Blocks 1 open bug)

Details

(Keywords: dataloss, Whiteboard: [needs owner][has patch])

Attachments

(1 file, 1 obsolete file)

On my Linux installation I included accounts from my Windows system. The files from Windows have CRLF as line ending, the ones native in Linux only LF. Labeling (by filter or by hand) only works if the file uses LF line endings when working on Linux. I edited some mbox files and changed them to LF line endings: now the label appears in X-Mozilla-Status2. If I change a files line endings from LF to CRLF, the label I set doesn't show up in X-Mozilla-Status2. I guess it's vice versa on Windows, there only files with CRLF line endings will become affected when setting the label. But I didn't test this for now.
Yep, using Windows it's vice versa. Having a mbox file with LF line endings the label will not get saved in the file, only in the .msf. This is 1. annoying at least when using mailboxes accross different OS and 2. strange since other changes like read/unread are written to the X-Mozilla-Status, resp. X-Mozilla-Status2 in all cases.
OS: Linux → All
Hardware: PC → All
*** Bug 226952 has been marked as a duplicate of this bug. ***
I think this is because we figure out where the x-mozilla-status2 line is by seeking relative to the x-mozilla-status line, and use the native line terminator in the offset calculation.
So it seems easy to fix, just read the real line terminator...
Would something like this do it? file nsMailDatabase.cpp: Somewhere around line 410: PRInt32 lineLen = PL_strlen(buf); fileStream->write(buf, lineLen); PRInt32 status2Pos = statusPos + lineLen; // time to update x-mozilla-status2 // first find it PRInt32 EOLskip; // skip at most 2 chars of the linebreak for (EOLskip=1; EOLskip<=2; EOLskip++) { status2Pos++; fileStream->seek(status2Pos); fileStream->readline(buf,1); if (PL_strlen(buf)) break; // we hit the first non-linebreak char } fileStream->seek(status2Pos); I can make a real patch, if the idea is OK.
Product: MailNews → Core
Keywords: dataloss
Whiteboard: has patch
aceman, can you make a patch for testing?
Summary: Label is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system → Labe is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system
woops, sorry for the bugspam, hit enter by accident.
Summary: Labe is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system → Label is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system
David, is this OS=All? Still valid?
Severity: normal → critical
QA Contact: esther → database
yes, looking at the code, it's still valid, and OS=ALL, and aceman's fix is roughly ok - I wouldn't use readline, though - I'd just use read and skip over 1 or 2 linebreak chars until I found an X.
Sorry, I am not familiar with mozilla code and functions, so I just used functions , where I could guess their meaning ;) I could look into it deeper, but it won't be soon. And I don't suffer from the problem in the description, I didn't migrate mi files to linux so far ;) I just threw in my fix proposal. Can anybody take it sooner?
Product: Core → MailNews Core
Blocks: tb-tagsmeta
Summary: Label is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system → Label is only stored in .msf file and not in mbox file if line ending of file isn't the one of the system (tag)
if someone can improve the patch please pick it up and run ... (even though bienvenu's assigned)
Flags: blocking-thunderbird3?
Whiteboard: has patch → [needs owner][has patch]
This seems to be a using Thunderbird on cross-platform issue which isn't really supported in Thunderbird's default configuration. Therefore not blocking TB 3 on this but we'd probably take the patch if someone would pick it up.
Flags: wanted-thunderbird3+
Flags: blocking-thunderbird3?
Flags: blocking-thunderbird3-
Attached file Patch against TB 3.1.4 (obsolete) —
Attachment #480429 - Flags: review?
Attachment #480429 - Flags: review? → review?(bienvenu)
Reporter, can you check this patch fixes your problem? Is it still relevant in Thunderbird 3.1?
If no one else fixed it, It’s still relevant. But I can’t test the fix since I currently have no installation to build TB.
Assignee: bienvenu → acelists
Attached patch tweaked fixSplinter Review
I've taken your patch and tweaked it a little. I'll land it soon. Thx for the patch!
Attachment #480429 - Attachment is obsolete: true
Attachment #480799 - Flags: review+
Attachment #480429 - Flags: review?(bienvenu)
I should point out that we don't store labels as flags anymore; we store them as keywords.
fix checked in.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.3a1
Thanks! I agree with your tweaks, I didn't know how to properly do error checking. Reporter, as the fix was checked in, it seems you could now try precompiled Thunderbird 3.3a1 nightlies. Please confirm if the patch works.
I just noted that as David wrote, labels are stored differently now and I don't know how to trigger change of X-Mozilla-Status2 for an existing message. At least everything works as it should when using files with "the other" file ending with the patch.
The problem with X-Mozilla-Status2 may be bug 383308, please join it if that is what you meant. Verifying this bug according to your comment.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: