Closed Bug 888741 Opened 11 years ago Closed 11 years ago

mozinstall should use mozfile.rmtree

Categories

(Testing :: Mozbase, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ffledgling, Assigned: ffledgling)

References

Details

Attachments

(1 file)

Mozinstall's uninstall method should use mozfile's rmtree rather than shutil's rmtree. Because using shutil.rmtree seems to be giving permission errors

--------------------

Traceback (most recent call last):
  File "test.py", line 169, in test_uninstall
    mozinstall.uninstall(installdir_zip)
  File "c:\documents and settings\anhad\mozbase-win\mozbase\mozbase\mozinstall\mozinstall\mozinstall.py", line 208, in uninstall
    shutil.rmtree(install_folder)
  File "c:\mozilla-build\python\lib\shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "c:\mozilla-build\python\lib\shutil.py", line 250, in rmtree
    os.remove(fullname)
WindowsError: [Error 5] Access is denied: 'c:\\docume~1\\anhad\\locals~1\\temp\\tmpb9p3ep\\zip\\firefox\\firefox.exe'

---------------------------------
OS: Linux → Windows XP
Hardware: x86_64 → x86
Attached patch PatchSplinter Review
Replacing shutil's rmtree with mozfile's.

I'm not entirely sure why this issue is occurring.
 
http://stackoverflow.com/questions/16183934/windows-error-5-access-is-denied-when-trying-delete-a-directory-in-windows seems to indicate it might be because of a write lock on the file or read/write permissions

mozfile.rmtree seems to have been written specifically to handle such cases
https://github.com/mozilla/mozbase/blob/master/mozfile/mozfile/mozfile.py#L138

And using it instead of shutil.rmtree indeed seems to fix the problem.
Attachment #769496 - Flags: review?(wlachance)
Blocks: 796017
Assignee: nobody → ffledgling
Comment on attachment 769496 [details] [diff] [review]
Patch

Review of attachment 769496 [details] [diff] [review]:
-----------------------------------------------------------------

lgtm
Attachment #769496 - Flags: review?(wlachance) → review+
pushed: https://github.com/mozilla/mozbase/commit/d07d2365c9280bea9854f59f6de585e9ee458cb1
Status: NEW → RESOLVED
Closed: 11 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: