Closed Bug 484329 Opened 11 years ago Closed 10 years ago

Upgrading to 3.0 causes "archives" folder disappears

Categories

(Thunderbird :: Folder and Message Lists, defect, major)

x86
Linux
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b4

People

(Reporter: m_kato, Assigned: Bienvenu)

Details

(Whiteboard: [has patch for review][no l10n impact])

Attachments

(1 file)

When I use version 2.0, I use a folder in mailbox as name as "archives".
After upgrading to 3.0, this "archives" folder disappears. because new feature of 3.0 creates "Archives" folder in mailbox.

- Environment
Thunderbird 3.0 beta2
Thunderbird 3.0 latest thunk

- Step
1. Install Thunderbird 2.0
2. Create "archives" (all low case) folder in your Local Folder
3. Move or copy a mail to it.
4. Upgrade to Thunderbird 3.0

- Result
Although "Archives" (first is upper case) folder is created, step 3's mail is missing into all folders !!

In filesystem, there is both archives and Archives.  So archives is ignore... So this occurs on only Unix style filesystem.

total 52
drwx------ 2 makoto makoto 4096 2009-03-20 13:05 .
drwxr-xr-x 4 makoto makoto 4096 2009-03-20 12:49 ..
-rw------- 1 makoto makoto 2460 2009-03-20 13:05 archives
-rw-r--r-- 1 makoto makoto    0 2009-03-20 13:05 Archives
-rw-r--r-- 1 makoto makoto 2324 2009-03-20 13:05 archives.msf
-rw-r--r-- 1 makoto makoto 1604 2009-03-20 13:06 Archives.msf
 :
 :


- Expected Result
If there "archives" folder, don't create "Archives' folder.
David, it looks like we need to do some case-insensitive matching here?
Flags: blocking-thunderbird3?
Sounds like we need to do something similar to what I did for the junk folder when deciding to try to create the archives folder in the first place...
Accepting blocking, and marking as 'good first bug' assuming that it's mostly a matter of looking at the Junk folder code.
Flags: blocking-thunderbird3? → blocking-thunderbird3+
Whiteboard: [good first bug]
Target Milestone: --- → Thunderbird 3.0b4
Known case sensitivity related issues on IMAP folder name.
         Case sensitivity
    IMAP server      Local file system
(a) sensitive(Linux) sensitive(Linux) : This bug
(b) sensitive(Linux) insensitive(Win) : Tb can't support both "abc" & "Abc"
                                        unless hashing like technique is used
                                        for file name.
(c) insensitive(Win) sensitive(Linux) : IIS returns "already exists" to
                     insensitive(Win)   "create Abc" if "abc" exists.  
                                        IIS returns "/ abc" to "list Abc".
                                        Tb can't process it well. (bugs exist)
Version: unspecified → Trunk
nsIMsgFolder::getChildWithUri has an option to do a case-insensitive lookup of a uri. So a possible fix in mailWindowOverlay.js would be to call this on the root folder for the uri returned from GetMsgFolderFromUri if that folder doesn't have a parent - if getChildWithUri finds the archives folder, we'd probably want to change the uri to the uri of the folder we found case-insensitively...
Whiteboard: [good first bug] → [good first bug][no l10n impact]
I'll try my suggestion.
Assignee: nobody → bienvenu
Status: NEW → ASSIGNED
Attached patch proposed fixSplinter Review
slightly more complicated than I thought, but this seems to work.

I don't expect an exception to get thrown, so in theory I could remove that try catch, or just leave it in...
Attachment #395681 - Flags: review?(mkmelin+mozilla)
Whiteboard: [good first bug][no l10n impact] → [has patch for review][no l10n impact]
Comment on attachment 395681 [details] [diff] [review]
proposed fix

>+      else {
>+        identity = getIdentityForHeader(msgs[0], Ci.nsIMsgCompType .ReplyAll);

There's an extra space before  .ReplyAll. But then again, you can just write getIdentityForHeader(msgs[0]); 

>+      if (srcFolder.server.type == 'rss') {
>+      // RSS servers don't have an identity so we special case the archives URI.

The comment should move two spaces in.

>       if (!archiveFolder.parent) {
>+        // make sure there's not an other archive folder with
>+        // a case-insensitive (ci) matching name. If so, we're going
>+        // to use that folder instead.
>+        let ciArchive = null;
>+        try {
>+          ciArchive = archiveFolder.server.rootFolder
>+                       .getChildWithURI(archiveFolderUri, true, true);
>+        } catch(ex) {dump(ex);};

Yeah doesn't look that exception would ever happen. If it does we're likely better off not moving any messages and just let if blow up.
Attachment #395681 - Flags: review?(mkmelin+mozilla) → review+
fix pushed, with comments addressed.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Why is this bug marked fixed when the patch attached here doesn't even fix the problem stated in comment #0?
(In reply to comment #10)
> Why is this bug marked fixed when the patch attached here doesn't even fix the
> problem stated in comment #0?

You might like to expand on that. Although I haven't tested it, my reading of comment 0 and the patch suggest that the patch was intended to fix the problem stated - which is to reuse a folder called archive if it already exists.
If I create a mail folder named "aRcHiVeS" and "move or copy a mail to it", it's not a folder on system level, just two files aRcHiVeS and aRcHiVeS.msf. 

Starting up an Archive aware TB/SM will not find the "Archives" folder and thus create a new one next to my one, hiding it in the GUI, thus I can't any mails inside the aRcHiVeS file anymore.

The patch here fixes up the scenario when someone hits the archive key etc., but the problem comment #0 reports arises much earlier.

Actually, you don't even need an old version to provoke the problem:
- Take any account without an archive folder, but mails in top level mailbox
  file XXX. If you don't have one, just delete all Archives* files and folders
  of an account on system level with SM/TB shut down. Startup again to see
  Archives is gone.
- Shutdown SM/TB.
- On system level, copy XXX and XXX.msf to aRcHiVeS and aRcHiVeS.msf.
- On startup, the files Archives and Archives.msf are created in the account, 
  hiding aRcHiVeS and its contained mail.
We only create the archives folder when you press the archive key - that's what this bug fixes. It doesn't fix the case where you already have two archives folders.
(In reply to comment #13)
> We only create the archives folder when you press the archive key

That's definitely not true. My steps in comment #12 were created with a Linux TB trunk debug build from yesterday. Please try to follow those steps.
Were you creating local mail folder or imap accounts? I don't know of any code that creates archives folder w/o you pressing the archive key, unless it's code that gets the archives folder uri and incidentally creates an nsIMsgFolder object...If I add a new pop3 account, I don't see an archives folder created automatically.
Here's what I see:

Create a 2.0 profile, create ARCHIVES folder, put a message in it.

Startup 3.0 - 3.0 shows it as Archives, but it still has the message in it, so it's just the pretty name that has changed. I haven't lost any messages.
(In reply to comment #15)
Account creation doesn't create an Archives folder.
IMAP is not the primary scope here, I used POP/Movemail/Local Folders.

But if the account directory "somehow" (manually created from within an old TB version, manually creation on system level like comment #12) acquires a file which modulo case is named archives, the file Archives is created, hiding the other one in the UI.

(IMAP seems to have other issues with a folder aRcHiVeS created by another program: TB finds and shows the folder aRcHiVeS, but archiving just deletes mail without it turning up in aRcHiVeS or any other Archives folder!)

(In reply to comment #16)
> Here's what I see:

IMAP or local?
(In reply to comment #17)
> IMAP is not the primary scope here, I used POP/Movemail/Local Folders.

Karsten Düsterloh, do you use Linux?
If so, check case sensitivity related issue on local mail folder first, please.
(1) Copy a mail folder file(no file extension of .msf) to "abc" and "ABC".
    Restart Tb. Both local mail folder of "abc" and "ABC" is accessible by Tb?
(2) Create mail folder of "xyz" and "XYZ" by Tb, and copy mails to them.
    What files are created by Tb?
    Restart Tb. Both local mail folder of "xyz" and "XYZ" is accessible by Tb?
(3) Copy a mail folder file(has some mails in it) to "aRCHIVES".
    Restart Tb. "Archives" folders appears at folder pane? Or "aRCHIVES"?
      Your previous comments say:
        - Archives & Archives.msf was created.
        - No mails in "Archive" folder at folder pane.
    Copy a mail to "Archive" folder. Saved in which file? "Archives"? "aRCHIVES"?

(In reply to comment #10)
> Why is this bug marked fixed when the patch attached here doesn't even fix the
> problem stated in comment #0?

RESOLVED/FIXED == patch is landed. VERIFIED/FIXED == fix verification test is OK.
FYI.
On MS Win-XP, who has case insensitive file system, both of (1) local "aRCHIVES" case and (2) Gmail IMAP "aRCHIVES" case were OK in my test with 2009/9/09 build. (Gmail IMAP is case insensitive at least for user defined Gmail Label. Gmail doesn't permit creation of both abc & ABC).
In any case, Tb used "aRCHIVES" for "Archive folder", although folder pane display becomes "Archives".
(1) Dummy POP3.
    local file of aRCHIVES
    aRCHIVES.msf or Archives.msf. depends on when .msf is created.
    aRCHIVES.sbd or Archives.sbd. depends on when first subdirectory is created.
(2) Gmail IMAP
    aRCHIVES.msf for IMAP folder of "aRCHIVES"
    aRCHIVES for offline-store
    aRCHIVES.sbd
You need to log in before you can comment on or make changes to this bug.