typo in mozprofile addons.py

RESOLVED FIXED

Status

Testing
Mozbase
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Jeff Hammel, Unassigned)

Tracking

({regression})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
From https://bugzilla.mozilla.org/show_bug.cgi?id=841086#c22

(mozmill)│mozprofile -a
/home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi
/tmp/tmpgJsvbt.mozrunner
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner
extensions  prefs.js  user.js
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner/extensions/
staged
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner/extensions/staged/
test-empty@quality.mozilla.org.xpi
(mozmill)│mozprofile -p /tmp/tmpgJsvbt.mozrunner -a
/home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi
Exception UnboundLocalError: "local variable 'addon' referenced before
assignment" in <bound method AddonManager.clean_addons of
<mozprofile.addons.AddonManager object at 0xa4c72ac>> ignored

Reduced test case:

(mozmill)│mozprofile -a
/home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi -p
$(mozprofile -a
/home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi)
Exception UnboundLocalError: "local variable 'addon' referenced before
assignment" in <bound method AddonManager.clean_addons of
<mozprofile.addons.AddonManager object at 0xa6b02cc>> ignored

And this is why we have tests, ladies and gentlemen:

diff --git a/mozprofile/mozprofile/addons.py
b/mozprofile/mozprofile/addons.py
index dcd5df3..8dbdf3c 100644
--- a/mozprofile/mozprofile/addons.py
+++ b/mozprofile/mozprofile/addons.py
@@ -257,7 +257,7 @@ class AddonManager(object):
             extensions_path = os.path.join(self.profile,
             'extensions', 'staged')
             for backup in os.listdir(self.backup_dir):
                 backup_path = os.path.join(self.backup_dir, backup)
-                addon_path = os.path.join(extensions_path, addon)
+                addon_path = os.path.join(extensions_path, backup)
                 shutil.move(backup_path, addon_path)
             if not os.listdir(self.backup_dir):
                 shutil.rmtree(self.backup_dir, ignore_errors=True)
(Reporter)

Updated

5 years ago
Blocks: 841086
(Reporter)

Comment 1

5 years ago
Created attachment 749037 [details] [diff] [review]
fix
Attachment #749037 - Flags: review?(wlachance)
Comment on attachment 749037 [details] [diff] [review]
fix

lgtm
Attachment #749037 - Flags: review?(wlachance) → review+
Regression from bug 759594.
Blocks: 759594
Keywords: regression
(Reporter)

Comment 4

5 years ago
pushed: https://github.com/mozilla/mozbase/commit/e04ac670b3e75e3da43a9884c464d0f7ca8e6116
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.