Closed Bug 381483 Opened 17 years ago Closed 17 years ago

Profile migration fails to migrate mail/newsgroups properly

Categories

(SeaMonkey :: Startup & Profiles, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.0a1

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file, 1 obsolete file)

When migrating newsgroups we don't migrate them properly. What currently happens is this:

Existing profile (news folder):

newsrc-news.mozilla-1.org
news.mozilla-1.org.msf
news.mozilla-1.org/...

Migrated profile:

newsrc-news.mozilla-1.org
host-news.mozilla.org/

The missing msf file probably doesn't matter.

What does matter is we get the following prefs set up:

user_pref("mail.server.server3.directory", "/home/moztest/.thunderbird/fw7u8ya6.default/News/host-news.mozilla.org");
user_pref("mail.server.server3.directory-rel", [ProfD]News/news.mozilla-1.org");
user_pref("mail.server.server3.newsrc.file", "/home/moztest/.thunderbird/fw7u8ya6.default/News/newsrc-news.mozilla-1.org");
user_pref("mail.server.server3.newsrc.file-rel", "[ProfD]News/newsrc-news.mozilla-1.org");

So directory-rel points to the wrong location. However no-one seems to know why we pre-pend "host-" onto the folder name, so I'm proposing we just drop it.

I've got a patch in progress, but still need to sort out a couple of issues.
Could this also be the reason why some mail-folders/mail-files were copied to the wrong account? After importing my mail to suiterunner mails from account1 were allocated at account2 just for example. I didn't have the time to examine this, but I will do it the next days when this is another problem as in this bug.
(In reply to comment #1)
Bug 268034 is for "mail folder to wrong account when same server" problem of Tb.
Sorry but I don't know whether Bug 268034 occurs on Seamonkey or not.
Sven Grull, same problem as Bug 268034?
To Mark Banner:
Bug 381387 seems to be different hostname/realhostname case (when Tb). 
 - All news accounts are on different news server, then no server name contention
 - server3 has hostname=news & realhostname=server-name-really-used.
   (Other news accounts have hostname=xxxx only where xxxx is unieque)
 - server9 of hostname=news / name=news looks to be created by migration,
   then access to server of "news" happens.
(In reply to comment #1)
> Could this also be the reason why some mail-folders/mail-files were copied to
> the wrong account? After importing my mail to suiterunner mails from account1
> were allocated at account2 just for example. I didn't have the time to examine
> this, but I will do it the next days when this is another problem as in this
> bug.
Note - this won't affect import of mail accounts, it'll only affect migration of existing profiles with mail accounts into new profiles.

(In reply to comment #3)
> To Mark Banner:
> Bug 381387 seems to be different hostname/realhostname case (when Tb). 
>  - All news accounts are on different news server, then no server name
> contention
>  - server3 has hostname=news & realhostname=server-name-really-used.
>    (Other news accounts have hostname=xxxx only where xxxx is unieque)
>  - server9 of hostname=news / name=news looks to be created by migration,
>    then access to server of "news" happens.

It may be related but I'm not sure if its the same as this from a quick glance. There has definitely been some effect of this bug on the profile in that bug, but I can't tell if its causing the problem in that case or not.

In the very short term I need to fix SM as we're waiting on this for bug 328887, but I know TB also has this bug as most of the SM profile migrator code was copied from TB, so I will try and fix TB as well later.
(In reply to comment #4)
> Note - this won't affect import of mail accounts, it'll only affect migration
> of existing profiles with mail accounts into new profiles.

Sorry I was a little bit imprecise. I was migrating from my existing SeaMonkey profile to a new suiterunner profile when the error occurred.
(In reply to comment #2)
> Sven Grull, same problem as Bug 268034?

Hmmm... I will check my relative paths as described in https://bugzilla.mozilla.org/show_bug.cgi?id=268034#c32 and try to migrate again.
(In reply to comment #6)
> (In reply to comment #2)
> > Sven Grull, same problem as Bug 268034?
> 
> Hmmm... I will check my relative paths as described in
> https://bugzilla.mozilla.org/show_bug.cgi?id=268034#c32 and try to migrate
> again.
> 
You'll want to wait at least until attachment 265711 [details] [diff] [review] (Fix writing of the target prefs.js) on bug 329744 lands because at the moment the wrong prefs.js is ending up in your new profile and that's not good.
Attached patch Potential fix (obsolete) — Splinter Review
I've not tested this yet, but I think this could be the fix.

At the moment there's two problems/weirdness:

1) For news servers we rename the folder to host-<server name>. No-one seems to know why and blame doesn't say either, so lets just drop that.
2) As mail/news/etc folders can become "<server name>", "<server name>-1" etc in the profile, when we set up the new *.directory prefs to be unique folders they may be different to what they were originally, this then causes them to be different to the .directory-rel pref for the same server.

In this second case we could keep them the same folder names, but I think that may cause problems in the future or if import/migrating into existing profiles (not that its possible yet). So the best way is to drop the directory-rel prefs during migration and let mailnews recreate them as necessary (see nsMsgIncomingServer.cpp).
Summary: Profile migration fails to migrate newsgroups properly → Profile migration fails to migrate mail/newsgroups properly
Attached patch The fixSplinter Review
This needs the patch "Fix writing of the target prefs.js v3" from bug 329744 applied to work.

See comment 8 for discussion of the problems and fixes. I've also found the wstringValue member of the PrefBranchStruct isn't used, so I'm ditching that here as well.
Attachment #265994 - Attachment is obsolete: true
Attachment #266080 - Flags: superreview?(neil)
Attachment #266080 - Flags: review?(neil)
Comment on attachment 266080 [details] [diff] [review]
The fix

>+  // In case the length changed.
>+  count = aMailServers.Length();
I don't like this double loop. I think I'd prefer a single loop, and manually adjusting i and/or count as necessary. r+sr=me with that fixed.
Attachment #266080 - Flags: superreview?(neil)
Attachment #266080 - Flags: superreview+
Attachment #266080 - Flags: review?(neil)
Attachment #266080 - Flags: review+
(In reply to comment #10)
> (From update of attachment 266080 [details] [diff] [review])
> >+  // In case the length changed.
> >+  count = aMailServers.Length();
> I don't like this double loop. I think I'd prefer a single loop, and manually
> adjusting i and/or count as necessary. r+sr=me with that fixed.
> 
Checked in with a single loop.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
With suiterunner build 2007052723 the migration of news and mail folders worked flawlessly for me as far as I can tell for the moment. At least everything is in the right place :-)
Blocks: 467015
Target Milestone: --- → seamonkey2.0a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: