Closed Bug 360659 Opened 18 years ago Closed 18 years ago

Migration wizard fails with error 'NS_ERROR_FILE_UNRECOGNIZED_PATH'

Categories

(Calendar :: Import and Export, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ssitter, Assigned: mattwillis)

Details

Attachments

(1 file, 3 obsolete files)

Migrator error 'NS_ERROR_FILE_UNRECOGNIZED_PATH' during Sunbird startup using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/2006111404 Calendar/0.4a1

Profile path used is 'C:\Documents and Settings\anonymous\Application Data\Mozilla\Sunbird\Profiles\16aah96q.test'

Steps to Reproduce:
1. Start Profile Manager
2. Create new profile
3. Start Sunbird with new profile

Actual Results: Console output:

mIsLightning is: false

mPlatform is: winnt

Checking for the old calendar extension/app

Warning: assignment to undeclared variable ffProf
Source File: chrome://calendar/content/migration.js Line: 404

Warning: assignment to undeclared variable idx
Source File: chrome://calendar/content/migration.js Line: 740

Error: Migrator error: [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame :: chrome://calendar/content/migration.js :: gdm_getNorm :: line 742"  data: no]
Source File: chrome://calendar/content/calendarManagement.js Line: 283
Hmm... this error says the migrator thinks it's Lightning, despite the original reporting that mIsLightning is false.  That's very bad.
Confirming, I see the same with:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061114 Calendar/0.4a1
(In reply to comment #1)
> Hmm... this error says the migrator thinks it's Lightning, despite the original
> reporting that mIsLightning is false.  That's very bad.

No, it's in the next block down. The line numbers are off due to the #ifdef crap earlier in the file.


(In reply to comment #0)
> Warning: assignment to undeclared variable ffProf
> Source File: chrome://calendar/content/migration.js Line: 404
That's a typo.

> Warning: assignment to undeclared variable idx
> Source File: chrome://calendar/content/migration.js Line: 740
We're just missing a var idx;.

> Error: Migrator error: [Exception... "Component returned failure code:
> 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]" 
> nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame
> :: chrome://calendar/content/migration.js :: gdm_getNorm :: line 742"  data:
> no]
> Source File: chrome://calendar/content/calendarManagement.js Line: 283

This is concerning.  We should probably LOG() the computed filename so we can compare it to what really exists on the system.
Attached patch Fixes some of the bugs (obsolete) — — Splinter Review
This picks off the easy bits first.
Then we can see if this has more problems.

I'd like to get it in now since the Mac nightly hasn't run yet (due to the office power outage).
Assignee: nobody → lilmatt
Status: NEW → ASSIGNED
Attachment #245562 - Flags: first-review?(jminta)
I added additional LOG before the failure location in [http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/calendar/base/content/migration.js&rev=1.3&mark=751#744] that shows the path:

gdm_getNorm: idx=74; appSpec=/C:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/Mozilla/
707         var profileDir = this.dirService.get("ProfD", Ci.nsILocalFile);
708         var appSpec = this.ioService.newFileURI(profileDir).path;
709         var localFile = Cc["@mozilla.org/file/local;1"]
710                         .createInstance(Ci.nsILocalFile);

749                     idx = appSpec.indexOf("Sunbird");
750                     appSpec = appSpec.substr(0, idx);
751                     localFile.initWithPath(appSpec);
752                     localFile.append(aAppName);
753                     localFile.append("Profiles");

That code seems a bit too complex. You start with a nsILocalFile, then you get the path, just to create a new nsILocalFile. I think we can skip the path-part, and clone the nsILocalFile and modify that.
(In reply to comment #6)
> 707         var profileDir = this.dirService.get("ProfD", Ci.nsILocalFile);

This code will also fail if the profile folder is in a non default location, e.g. 'D:\data\foobar'. This code probably should use "DefProfRt" instead of "ProfD" to get the root profile folder.
Comment on attachment 245562 [details] [diff] [review]
Fixes some of the bugs

the strict warnings have been fixed with Bug 360696
Attachment #245562 - Attachment is obsolete: true
Attachment #245562 - Flags: first-review?(jminta)
Same error (but different source location) with Lightning/0.4a1 (2006112803) on Windows 2000.
OS: Windows XP → Windows 2000
Summary: Migrator error 'NS_ERROR_FILE_UNRECOGNIZED_PATH' during Sunbird startup → Migration wizard fails with error 'NS_ERROR_FILE_UNRECOGNIZED_PATH'
Stefan,
Does using DefProtRt fix this when using non-standard profile paths?
please feel free to take over the patch and resubmit it.

The open question is regarding custom profile paths. A solution would be to parse the profiles.ini file and scan all profile paths that are mentioned in there.

Also, I didnt touch the Mac specific code because I can not test it.
Attached patch cleanup of first version (obsolete) — — Splinter Review
this is a cleanup of my first version. tested on Windows and Linux. Not tested, but also patched, for Mac. This is not addressing the "parse ini file" idea.
Attachment #248002 - Attachment is obsolete: true
Attachment #248732 - Flags: second-review?(jminta)
Attachment #248732 - Flags: first-review?(lilmatt)
Comment on attachment 248732 [details] [diff] [review]
cleanup of first version

r=lilmatt
Attachment #248732 - Flags: first-review?(lilmatt) → first-review+
Comment on attachment 248732 [details] [diff] [review]
cleanup of first version

                 case "darwin": // Mac OS X
-                    truncate = appSpec.indexOf("Application");
-                    appSpec = appSpec.substr(0, truncate);
-                    localFile.initWithPath(appSpec);
+                    localFile = profileRoot.parent.parent.parent;
                     localFile.append("Thunderbird");
                     localFile.append("Profiles");
                     break;
                 case "winnt":
-                    truncate = appSpec.indexOf("Mozilla");
-                    appSpec = appSpec.substr(0, truncate);
-                    localFile.initWithPath(appSpec);
+                    localFile = profileRoot.parent.parent.parent;
                     localFile.append("Thunderbird");
                     localFile.append("Profiles");
The darwin and winnt cases here are now identical, so you should just group them together.
r2=jminta
Attachment #248732 - Flags: second-review?(jminta) → second-review+
Attached patch addressing jmintas comment — — Splinter Review
Can someone check this in, please?
Attachment #248732 - Attachment is obsolete: true
Attachment #250380 - Flags: second-review+
Attachment #250380 - Flags: first-review+
Adding [needs checkin] to the Status Whiteboard may get it checked in sooner in the future.

Patch checked in on MOZILLA_1_8_BRANCH and trunk.

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Verified with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a2pre) Gecko/20070104 Calendar/0.4a1. The migration wizard successfully imported some dummy events created with Sunbird 0.2 and no more errors in console :-)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: