Closed Bug 805466 Opened 13 years ago Closed 13 years ago

Remove old MozUpdater-i folders in $TEMP in PostUpdate

Categories

(Toolkit :: Application Update, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: bbondy, Assigned: no52fear)

References

Details

(Whiteboard: [mentor=bbondy][lang=js])

Attachments

(1 file, 2 obsolete files)

+++ This bug was initially created as a clone of Bug #765598 +++ In Bug 765598 we delete newly created $Temp/MozUpdater/* folders, but we have a lot of old folders left over in $Temp/MozUpdater-i/*. This bug is to delete those old directories.
Attached patch Patch v0 (obsolete) — Splinter Review
I finished cleaning up the MozUpdater folders in NSIS but Ehsan just reminded me that this bug is not Windows only. So just posting this in case I ever need similar code.
This bug is to remove old MozUpdater folders that exist in the user's temp directory. To do this bug you will have code very similar to this patch: https://bug765598.bugzilla.mozilla.org/attachment.cgi?id=674685 The difference that you'll do is: 1. Only try to delete the folders if MozUpdater-1 exists 2. Try to delete MozUpdater-i where i > 1 3. Do step 2 up to 10 times. 4. If you enumerate the whole temp directory and the count of deleted items is less than 10, then delete MozUpdater-1. The change is in toolkit/mozapps/update/nsUpdateService.js inside cleanUpMozUpdaterDirs.
Whiteboard: [mentor=bbondy][lang=js]
Attachment #675180 - Attachment is obsolete: true
More information: You can see these temp directories on Windows in explorer by typing %temp% in run. You can test this bug by typing in test code into the following: 1. Go to about:config 2. Set devtools.chrome.enabled to true 3. In the Firefox menu go to Web Developer -> Scratch Pad 4. In the Environment menu select Browser
Assignee: nobody → no52fear
Attachment #676588 - Flags: review?(netzen)
Comment on attachment 676588 [details] [diff] [review] Remove old MozUpdater-i folders in $TEMP in PostUpdate Review of attachment 676588 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the patch, looks great, only minor changes. nit: Remove trailing whitespace on a few of the new lines. ::: toolkit/mozapps/update/nsUpdateService.js @@ +760,5 @@ > getService(Components.interfaces.nsIProperties). > get("TmpD", Components.interfaces.nsIFile); > + > + // We used to store MozUpdater-i folders directly inside the temp directory. > + // "i" is the first available positive integer. nit: Remove this line: // "i" is the first available positive integer. @@ +783,5 @@ > + // items is less than 10, then delete MozUpdate-1. > + if (i < 10) { > + mozUpdaterDir1.remove(true); > + } > + return; Let's remove the return; here so we still remove the newly created folders. Some machines that are used to run tests may have thousands of these folders, so it would be good not to let the other folders in the new location build up.
Attachment #676588 - Flags: review?(netzen) → feedback+
Applied the review changes.
Attachment #676588 - Attachment is obsolete: true
Attachment #676917 - Flags: review?(netzen)
Comment on attachment 676917 [details] [diff] [review] Remove old MozUpdater-i folders in $TEMP in PostUpdate I'll land this on inbound soon.
Attachment #676917 - Flags: review?(netzen) → review+
Thanks for the patch! Now that you have a couple of patches in and accepted could you: 1) File a bug to get level 1 commit access. This will allow you to push to try More info here: http://www.mozilla.org/hacking/commit-access-policy/ Example bug: https://bugzilla.mozilla.org/show_bug.cgi?id=671744 2) Get editbugs access, just send an eamil and quote the 2 bugs you completed: http://www.gerv.net/hacking/before-you-mail-gerv.html 3) Sign up here: https://mozillians.org/en-US/ It'll give you a user page and be more visible as a member of the community.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: