Closed Bug 65680 Opened 25 years ago Closed 25 years ago

Need file-replace utility for Mac

Categories

(Core Graveyard :: Installer: XPInstall Engine, defect, P1)

PowerPC
All
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.8.1

People

(Reporter: dveditz, Assigned: samir_bugzilla)

References

Details

(Whiteboard: [xpiprd])

Attachments

(8 files)

Need a Mac native utility to perform the the post-install replaces
Keywords: nsbeta1
Whiteboard: [xpiprd]
Moz 0.9 tasks
Target Milestone: --- → mozilla0.9
This is critical. Perhaps only need to help dbragg write the NativeReplace and NativeDelete routines to plug into the generic framework he wrote for win/linux
Priority: -- → P1
Target Milestone: mozilla0.9 → mozilla0.8
Not attached but also new is the XPICleanup.mcp project file.
Status: NEW → ASSIGNED
Comments: vr_stubs.c You didn't touch it directly, but the hacky mac -> Unix path conversions in this file will break if there is a / anywhere in the folder path. This code needs to be tested with wacky paths. InstallCleanupMac.cpp: I'm really reluctant to approve code that uses full path strings to move and delete files; it's so hard to do sanity checking, and very dangerous. Where are these paths coming from? I think you need to at least test for obvious bad cases, like empty strings, strings with no leaf name, or strings with a leading :.
Thanks for the comments Simon. These full paths are coming from libreg. Although libreg stores Mac aliases, the file locations are returned as full paths. There was some vague mention of this changing but given the current resource constraints I don't anticpate this happening soon. I'll leave it to Dan Veditz and Don Bragg to comment in greater detail on paths being returned by libreg and any timeline on when this might change. For now I will revise InstallCleanupMac.cpp by adding a routine to verify the full paths per the criteria you have specified and resubmit for r and sr thereafter. Thanks again.
Actually if you look at ScheduledTask.cpp you'll see that a half-hearted attempt was made to store persistent data, creating a local GetPersistentStringFromSpec() routine before nsILocalFile supported such a thing. The delete/replace lists don't use the libreg FILE type so there's no requirement that it store file paths the way the version registry stuff currently does. Of course, Doug didn't come back and finish this when he implemented the required nsILocalFile feature. It'd be a one-line change in ScheduledTasks.cpp to make GetPersistentStringFromSpec() use LocalFile->GetPersistentDescriptor() instead of LocalFile->GetPath(). On the Mac utility side you'd have to duplicate most of the SetPersistentDescriptor() stuff from nsLocalFileMac.cpp since you won't be able to call into XPCOM for this service. Looks pretty simple. (You'll also need a local equivalent to PL_Base64Decode() from mozilla/nsprpub/lib/libc/src/base64.c)
Is there any reason we actually have to pass persistent descriptors around here? Those are intended to be saved to disk between runs, not to be passed around as proxies for file specifiers, and, in this latter use, they may have some undesirable behaviours (the Alias Manager loves to try to 'fix up' aliases, which is what they are on Mac, when files go missing). Perhaps it would be OK to use them, but bail if the 'wasChanged' param of ResolveAlias returns true, or something.
Yes, they're persistent because the replace utility has to run at some later time once Mozilla has shut down. Mozilla needs to communicate with this utility in some way, which it does by storing the persistent descriptors (or file paths, or do you have better suggestions?) in a file.
Since the current Netscape 6/Mozilla stores full paths the utility will have to handle the current format in the upgrade case. I spun off bug 67858 to switch to using aliases in the future, but this fix is not wasted since we'll have to keep this code as well.
Blocks: 67858
r=dbragg for the path verification changes made in the last attachment.
Simon, Please super review the 4th patch that incorporates your suggestions to verify the paths. Thanks.
(strcmp(aPath, "") == 0) is an expensive way to check for an empty string. Try (!*aPath) or (*aPath == '\0'). An an additional safety check, do we know what the file types/creators will be for the files that we're deleting? If so, perhaps we can check them at cleanup time. Sorry to be paranoid, but I'm always scared with code that deletes files.
sr=sfraser on the last patch, anyhow.
r=sfraser again.
The replace utility is generic for all kinds of files including jars, shared libraries, and even arbitrary third party files so we do not know the creator codes or file types of the files being replaced or deleted. Thus, although it is clearly a good idea to be paranoid about verifying file types and creators at deletion time we can not be confined to a list of types or creators.
Not happening for m0.8
Target Milestone: mozilla0.8 → mozilla0.9
Keywords: nsbeta1 → nsbeta1+
Regarding the last patch attached: Don, Please bless with an r. Simon, Please bless witha n sr. Thanks!
Looks like what we want. r=dbragg.
Where are the implementation for PerformScheduledTasks() and sleep() ? You should also use const char* for non-modified file path params.
PerformScheduledTasks() is in InstallCleanup.cpp which is XP code covered by another bug. I'm using the standard sleep() from the MSL C Runtime.
Did you look at MSL's sleep() implementation? It just calls Delay(), which is bad.
Oops, didn't realize the text was performatted. Let's try that last comment iwth the above patch again: (*) Made XPICleanup a faceless background app (*) Made it so an alias to XPIClenaup is put in the Startup Items folder and deleted when the app is done Don, Please r. Simon, Please sr. Thanks.
For what my Mac experience is worth I give it a resounding R=DBRAGG.
You should remove this comment: // faceless background apps only get a 2K stack by default. If necessary, // increase the stack size here (by calling GetApplLimit to find the current // heap limit, and SetApplLimit to set it to a lower address, thus reserving // more space for the stack) since it only applies to 68k code. Otherwise, sr=sfraser. But please test the heck out of this, including the restart case.
Blocks: 65678
No longer blocks: 67858
Depends on: 67858
Target Milestone: mozilla0.9 → mozilla0.8.1
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Build: 2001-06-07-11-0.9.1(MAC) Files can be replaced on Mac. Cleanup occurs. No vtrunk needed since this was checked in before 0.9. Marking Verified!
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: