Closed
Bug 931894
Opened 11 years ago
Closed 11 years ago
[mozprofile] IOError in AddonManager.__del__ when trying to backup an already existent unpacked add-on
Categories
(Testing :: Mozbase, defect)
Testing
Mozbase
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: whimboo, Assigned: whimboo)
References
Details
Attachments
(1 file, 2 obsolete files)
6.11 KB,
patch
|
ahal
:
review+
|
Details | Diff | Splinter Review |
With the Addon Manager you can install the same addon twice, e.g. when they have different file names or locations. In those cases the addon in the profile will be removed successfully for the first installed version. But then __del__ fails for the second one, because it really only exists once in the profile: Exception IOError: IOError(2, 'No such file or directory') in <bound method AddonManager.__del__ of <mozprofile.addons.AddonManager object at 0xd60550>> ignored Here my list of test add-ons: AddonManager._addons: [u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/memchaser@quality.mozilla.org.xpi', u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/another-test-empty@quality.mozilla.org.xpi', u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/test-empty@quality.mozilla.org.xpi', u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/{8620c15f-30dc-4dba-a131-7c5d20cf4a29}', u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/another-test-empty@quality.mozilla.org', u'/tmp/tmpjIbaWK.mozrunner/extensions/staged/another-test-empty@quality.mozilla.org'] AddonManager.installed_addons: ['/tmp/tmpBLAy5j.memchaser-0.5.2.1-fx.xpi', '/tmp/tmpWG46zC.another-empty-0-1.xpi', '/tmp/tmpLBrR85.empty.xpi', '/tmp/tmp4pkA_E.nightly_tester_tools-3.6-tb+sm+fx.xpi', '/mozilla/code/mozbase/xpi/another-empty-0-1', '/mozilla/code/mozbase/xpi/another-test-empty@quality.mozilla.org'] I think we should not allow additional installations of the same addon if another one with the same ID has already been installed.
Comment 1•11 years ago
|
||
I
Comment 2•11 years ago
|
||
beh, premature submit. I don't think we should disallow installation of the same addon ID; IIRC, a different version (version number or otherwise )will have the same ID and it may be desirable to install the new version. I do think we shouldn't clean up twice. Once is plenty
Assignee | ||
Comment 3•11 years ago
|
||
Oh, that's correct and makes sense. I missed this specific use-case.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•11 years ago
|
||
So the problem here is that we fail in backing up the unpacked add-on. Instead of creating a subfolder for it at the backup location we copy all files directly into the parent folder. Sadly I can't provide a patch yet due to the strange issue that the temporary profile folder is left and doesn't get removed. This has somewhat to do in our moving of files. I have no idea yet what it's causing it. I will continue tomorrow.
Summary: [mozprofile] IOError in AddonManager.__del__ if same add-on got installed twice → [mozprofile] IOError in AddonManager.__del__ when trying to backup an already existent unpacked add-on
Assignee | ||
Comment 5•11 years ago
|
||
As mentioned on IRC already, there is one problem here. We do not remove the created profile at the end of the tests. I have absolutely no idea why. Any call to rmtree etc. succeeds and I don't get any failure. Andrew, if you have some minutes and could have a look at it would be great. Just run the following commands to hopefully see this issue: 1. rm -rf /tmp/tmp* 2. Run ´python mozprofile/tests/test_addons.py´ 3. ls -l /tmp* As you can see one .mozrunner folder is left.
Attachment #824953 -
Flags: feedback?(ahalberstadt)
Comment 6•11 years ago
|
||
Comment on attachment 824953 [details] [diff] [review] Patch v1 Review of attachment 824953 [details] [diff] [review]: ----------------------------------------------------------------- It looks like it is getting cleaned up, but then at some point afterwards the install.rdf file is getting re-created in it's old location which creates the whole directory structure again.
Attachment #824953 -
Flags: feedback?(ahalberstadt)
Assignee | ||
Comment 7•11 years ago
|
||
Hm, that would explain it. Looks like some weird path is hit here which tries to restore the add-on once more, even when it shouldn't. I will dive into that.
Assignee | ||
Comment 8•11 years ago
|
||
If we do not restore the backup of the duplicated add-on in the clean_addons() method, the backup folder with the add-on will remain. It looks like that some other process still has a handle on it.
Assignee | ||
Comment 9•11 years ago
|
||
Heh, got it. Interestingly we call profile.cleanup() before AddonManager.clean_addons() is executed. That means that a backup which we have created gets restored after the profile has been removed! So we end-up with the same profile again.
Assignee | ||
Comment 10•11 years ago
|
||
Given that this problem might be larger I filed bug 934484 for it. I will go ahead and request review on this patch given that it fixes the exception and only has the caveat to leave a tmp folder behind in case a duplicated add-on is getting installed.
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #824953 -
Attachment is obsolete: true
Attachment #826771 -
Flags: review?(jhammel)
Assignee | ||
Comment 12•11 years ago
|
||
Comment on attachment 826771 [details] [diff] [review] Patch v1.1 Review of attachment 826771 [details] [diff] [review]: ----------------------------------------------------------------- Moving to Andrew given that Jeff is overloaded.
Attachment #826771 -
Flags: review?(jhammel) → review?(ahalberstadt)
Comment 13•11 years ago
|
||
Comment on attachment 826771 [details] [diff] [review] Patch v1.1 Review of attachment 826771 [details] [diff] [review]: ----------------------------------------------------------------- Makes sense to me. ::: mozprofile/mozprofile/profile.py @@ +237,4 @@ > break > except: > count += 1 > + except ImportError, e: Not necessary ::: mozprofile/tests/test_addons.py @@ +101,5 @@ > + > + # Bug 934484 > + # Currently the profile folder gets recreated at the end and will be left > + # behind. So we should add another test for its existence once the bug > + # has been fixed. If this test leaves behind the tmp profile dir we should delete it manually after the test is finished.
Attachment #826771 -
Flags: review?(ahalberstadt) → review+
Assignee | ||
Comment 14•11 years ago
|
||
Comment on attachment 826771 [details] [diff] [review] Patch v1.1 Review of attachment 826771 [details] [diff] [review]: ----------------------------------------------------------------- ::: mozprofile/mozprofile/profile.py @@ +237,4 @@ > break > except: > count += 1 > + except ImportError, e: Ups. That's a left-over from testing where I have printed the exception details. ::: mozprofile/tests/test_addons.py @@ +101,5 @@ > + > + # Bug 934484 > + # Currently the profile folder gets recreated at the end and will be left > + # behind. So we should add another test for its existence once the bug > + # has been fixed. Ok, will do.
Assignee | ||
Comment 15•11 years ago
|
||
So the reason why we don't correctly delete the profile folder might be related to weak references to the add-on manager in the test module. A final solution I will work out on bug 934484.
Attachment #826771 -
Attachment is obsolete: true
Attachment #827025 -
Flags: review?(ahalberstadt)
Updated•11 years ago
|
Attachment #827025 -
Flags: review?(ahalberstadt) → review+
Assignee | ||
Comment 16•11 years ago
|
||
Landed on master: https://github.com/mozilla/mozbase/commit/2de29b0e449ff8ee18cd4d67aa9ecac8a5272bc4
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•