Closed Bug 42102 Opened 26 years ago Closed 18 years ago

File preferences should be stored as nsIFile objects not nsIFileSpec objects

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alecf, Assigned: mscott)

References

Details

(Keywords: intl)

Attachments

(1 file)

prefs needs to switch it's interface for GetFilePref/SetFilePref() to use nsIFile instead, because nsIFileSpec is not i18n friendly. In order for this to happen, bug 42099 must be fixed - because we need to be able to persistently store an nsIFile the same way nsIFileSpecs could. The biggest consumer of GetFilePref() is mail, specifically in my own code, so I will tackle this one.
inserting into dependancy tree.
Blocks: 41083
Status: NEW → ASSIGNED
Depends on: 42099
Whiteboard: nsbeta3
Target Milestone: --- → M18
Moving nsbeta3 keyword nomination from Status Whiteboard to Keyword field. Put in wrong field. :-(
Keywords: nsbeta3
Whiteboard: nsbeta3
Depends on: 36965
+ per mail triage. We had talked to alec on this one.
Whiteboard: [nsbeta3+]
Priority: P3 → P1
marking in progress so others don't waste time on this
Whiteboard: [nsbeta3+] → [nsbeta3+] Working on a fix
good news - after conrad's landing we're down to only 12 occurances of GetFilePref and 13 occurances of SetFilePref. The next stage is to convert these to Get/SetFileXPref.. working on this now
PDT doesn't understand what bad thing happens if we don't fix this. The pref file name can't be localized? No big deal. Setting to P3 and leaving [PDTP3] breadcrumb. We assume you'll let us know if we've misunderstood :-)
Priority: P1 → P3
Whiteboard: [nsbeta3+] Working on a fix → [nsbeta3+] Working on a fix [PDTP3]
you've misunderstood :) The problem is that you can't store international characters in prefs - which means any pref (such as your cache dir, signature dir, etc) does not get stored correctly.
ok, I've checked in all fixes except: - mailnews - profile migration because I'm getting platform testing done on each of these. we're real close, but my fixes definately need a few days to bake and make sure they don't break anything, so I'm not checking in until probably 4-Sep or 5-Sep
Whiteboard: [nsbeta3+] Working on a fix [PDTP3] → [nsbeta3+] Fix in hand, testing [PDTP3]
Alec, can you check this in yet? Moving to P2, removing PDTP3 crumb.
Priority: P3 → P2
Whiteboard: [nsbeta3+] Fix in hand, testing [PDTP3] → [nsbeta3+]
re-marking "Fix in hand" - doing linux testing today, should be ready to land very soon
Whiteboard: [nsbeta3+] → [nsbeta3+] Fix in hand, testing
PDT agrees P2
Whiteboard: [nsbeta3+] Fix in hand, testing → [nsbeta3+] [PDTP2] Fix in hand, testing
ok, platform details seem to have been flushed out. I'll will try to check this in monday, 9/18.
My patch is huge. it scares me. I'm now too scared to checkin. Now that I know embedding is going to be on the trunk, I'm going to let this get triaged away for N6 and will checkin to the trunk when the time comes.
Not holding PR3 for this. Marking nsbeta3-. If something needs to happen here before we ship, please nominate for rtm.
Whiteboard: [nsbeta3+] [PDTP2] Fix in hand, testing → [nsbeta3-] [PDTP2] Fix in hand, testing
nominating for rtm. I'll land this as soon as the tree opens for RTM so we have maximum testing time.
Keywords: rtm
rtm+, need to be able to store prefs correctly.
Whiteboard: [nsbeta3-] [PDTP2] Fix in hand, testing → [nsbeta3-] [PDTP2][rtm+] Fix in hand, testing
Alec, do you have an r= and sr= for this? is this something we want to land on the trunk first to try out before landing on the branch?
Alec, is this fix really just for embedding? In which case it doesn't need to be on the branch. PDT is scared by your 9/21 comments.
Heh, I think that checking this fix in on the trunk first is a good idea. I was just too scared to check in for nsbeta3. The main reason for this fix is for i18n-friendly paths - otherwise alot of mail stuff gets all confused when mail folder paths and the signature are stored in a directory that has a non-ASCII name. I'll get a reviewer and superreviewer ASAP.
Whiteboard: [nsbeta3-] [PDTP2][rtm+] Fix in hand, testing → [nsbeta3-] [PDTP2][rtm+ need info] Fix in hand, testing
need info until review and super review are done
Alec and I agree: minus for RTM.
Whiteboard: [nsbeta3-] [PDTP2][rtm+ need info] Fix in hand, testing → [nsbeta3-] [PDTP2][rtm-] Fix in hand, testing
Alec, Can you itemize which pathname prefs still cannot support non-ASCII? On 2000-09-01 you listed only 2 that are not fixed yet: - mailnews (can you be more specific) - profile migration (Just migration? Creating new non-ASCII profiles works?) On localized MacOSes, standard folders (e.g., System Folder, Preferences) are localized often in non-ASCII. Will these cause problems? Or do we use file handles for standard Mac folders?
On the Mac, file specification data is not stored as a path but as a file system alias. It's not affected by character set issues. Or at least the OS handles that for us.
To try and answer my own question, the only configurable file path I see in the mailnews UI is the path for the signature. Is that the only mailnews file path pref that is affected?
Target Milestone: M18 → mozilla0.6
Target Milestone: mozilla0.6 → mozilla0.9
clearing out old cruft
Keywords: nsbeta3, rtm
Whiteboard: [nsbeta3-] [PDTP2][rtm-] Fix in hand, testing
adding intl keyword
Keywords: intl
>because nsIFileSpec is not i18n friendly. I am not 100% sure that is still the case.
>because nsIFileSpec is not i18n friendly. That is not the only thing wrong with nsIFileSpec. Two other things: (1) nsIDirectoryService does not use nsIFileSpec - only nsIFile. (2) The conversion between file path <-> URL using nsFileSpec and nsFilePath does not produce the same results as Necko.
Nominating for nsbeta1.
Keywords: nsbeta1
Ugh.. this is just too much work for me.. all the consumers of nsIFileSpec are now in mail reassigning to putterman for mail triage, and CC'ing bnesse. With bnesse's work on complex pref types, we might not have to remove the nsIFileSpec type in order to freeze interfaces appropriately
Assignee: alecf → putterman
Status: ASSIGNED → NEW
If the way mail uses prefs to store files gets revamped, I'd like to be involved. Or, at least contribute my 2 cents. What I really think mail should do with its file prefs is to store them using XP, relative paths. We would then be able to regain the ability to move profile dirs (thus mail folders). The full paths that get stored by prefs on behalf of mail is one of the major things keeping us from doing this.
conrad - that would be great, but it seems like we need to fix this in a global way - i.e. all prefs done through the pref API should be stored relative to the profile dir, if the path in question is actually in the profile dir.... we've been talking in the new world of prefs to have a new way of getting prefs: void getComplexPref(in string prefName, in nsIID aIID, [retval] out nsQIResult value); which would attempt to do the conversion based on the IID of the object that was passed in.. the conversion for "nsIFile" should be the place where we check if the file is within the profile path, and if so store it in a relative format. it should be transparent to the callers, including mailnews
The current get/setComplexPref implementations take and return nsIFiles, but are still converting to nsIFileSpecs internally. This should change eventually but, as Alec noted, it will be "under the covers".
the other thing we can do with get/setComplexPref is understand the nsIFileSpec type in addition to nsIFile... then we can accept both types (deprecated or not) without any interfaces mentioning the deprecated types...
I can certainly add this functionality if it is deemed to be desirable. The problem, of course, is that if it's there, people will use it...
reassigning to racham. removing mozilla0.9 milestone. Is there anything besides the signature pref that's not correct? I don't expect this bug to get fixed any time soon just for that given what it appears the complexity of the fix it.
Assignee: putterman → racham
Target Milestone: mozilla0.9 → ---
signature was fixed... now you have the actual paths to the servers
Actually, the code is already written to suppport nsIFile (via Get/SetComplexValue). The real problem here is that all of the consumers of Get/SetFilePref will have to be changed to use nsIFile. Based on my conversion with Alec yesterday, Get/SetComplexValue now handles both nsIFile and nsIFileSpec. When this lands all of the consumers will need to call the ComplexValue methods. They can be individually swiched to nsIFile at the module owners whim. Taking the bug because it is really covered by work I've already done.
Assignee: racham → bnesse
Replacing the .9 milestone and accepting.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
> The real problem here is that all of the consumers of Get/SetFilePref will > have to be changed to use nsIFile. nsIPref has had for a while Get/SetFileXPref which takes an nsILocalFile. When I made the shift from nsIFileLocations -> nsIDirectoryService, I changed a bunch of file pref consumers to use nsILocalFile, so some of this is already done - if that's any consolation :-)
mailnews is the only consumer, that's why I assigned this to putterman... but if you want to do the work... :)
Oh... well I took it because it was assigned to Prefs:Backend and the summary implied a nsPrefs change. If the intention is otherwise, maybe we should change the bug :)
Target Milestone: mozilla0.9 → mozilla0.9.1
Priority: P2 → P3
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Alec - What's the user or development impact of this bug?
Bumping to 0.9.3.
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Updating milestones
Target Milestone: mozilla0.9.3 → mozilla1.0
Blocks: 104166
Giving a summary more fitting to the task and over to Mail/News for implementation as per alecf's earlier comments.
Assignee: bnesse → mscott
Status: ASSIGNED → NEW
Component: Preferences: Backend → Mail Back End
Priority: P3 → --
Product: Browser → MailNews
QA Contact: sairuh → esther
Summary: Need to convert Get/SetFilePref() to use nsIFile → File preferences should be stored as nsIFile objects not nsIFileSpec objects
Target Milestone: mozilla1.0 → ---
Product: MailNews → Core
Mozilla user for years, suddenly everytime I restart machine all preferances and window layouts of Mozilla go back to default, I can not copy this bug in Linux
This was fixed as part of bug 33451 and its dependencies. Adding dep & marking fixed.
Status: NEW → RESOLVED
Closed: 18 years ago
Depends on: 33451
Resolution: --- → FIXED
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: