Closed Bug 1139873 Opened 9 years ago Closed 9 years ago

[mozinstall] get_binary() should not remove the build folder if the specified binary cannot be found

Categories

(Testing :: Mozbase, defect)

defect
Not set
critical

Tracking

(firefox41 fixed)

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: whimboo, Assigned: parthbakshi, Mentored)

References

()

Details

(Keywords: dataloss, Whiteboard: [lang=py][good first bug])

Attachments

(1 file, 1 obsolete file)

Right now get_binary() is removing the whole build folder if the expected binary is not found. I consider this a dataloss.

http://mxr.mozilla.org/comm-central/source/mozilla/testing/mozbase/mozinstall/mozinstall/mozinstall.py#84

IMO the calling code has to make a decision what to do with the folder, if the build has been installed. If code is using a real binary folder without installation, we currently are removing this folder!
Andrew, and William what do you think? When we have an agreement I would like to set this up as a mentored bug. Thanks.
Flags: needinfo?(wlachance)
Flags: needinfo?(ahalberstadt)
Yeah, that seems pretty bad! Should definitely be fixed.
Flags: needinfo?(wlachance)
Flags: needinfo?(ahalberstadt)
Alright. Lets see if we can find someone who has interest to work on this bug. I will put it up as mentored.
Mentor: hskupin
Whiteboard: [lang=py]
Whiteboard: [lang=py] → [lang=py][good first bug]
Hey there. I would definitely like to take this on. This will be my second bug, so I still may need a little guidance, but am very excited to work on it.

I have found the file location in my local database. So what exactly should I do here? Have another check which does not delete the folder under a circumstance?
It's even easier than that. Just remove the lines which delete files of the installation folder in case the binary cannot be found. That's all. Afterward please run all the mozbase tests via tests.py to ensure that all tests are still passing.
Assignee: nobody → jgersztyn13
Status: NEW → ASSIGNED
Right, right. That's almost too easy! I will get it changed, test, and submit the patch soon.
Hey there, I would like to work on this bug if no progress has been made yet. This is my first bug so will definitely need guidance. Let me know if the patch has not been submitted yet.
No progress. Got too busy with college and have had no time for open source. Hopefully one of these fine people can give you access to it, since I don't need it anymore.
Hi, thanks for your interest! The mentor of this bug (whimboo) is away until next week, but it looks like there is enough information in here for you to get started. See the link in comment 0 and the hint in comment 5. Feel free to ask questions if you get stuck.
Assignee: jgersztyn13 → parthbakshi
I have used Mercurial in the past, do i just submit a patch in this ticket, or merge somewhere?
Yes, you can just attach a patch to this bug. You may want to take a quick look through:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide

Especially the "How to submit a patch" section. Cheers!
I have attached the patch for review, let me know if i need to make any changes.
All tests were successful after applying the patch.
Comment on attachment 8599638 [details] [diff] [review]
Bug 1139873 - [mozinstall] get_binary() will not remove the build folder

Thank you for the patch. I will set the review flag for me so that I can have a look at it soon.
Attachment #8599638 - Flags: review?(hskupin)
Comment on attachment 8599638 [details] [diff] [review]
Bug 1139873 - [mozinstall] get_binary() will not remove the build folder

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

f+ with just a nit to fix. Once done we can get your patch landed.

::: testing/mozbase/mozinstall/mozinstall/mozinstall.py
@@ -83,5 @@
>  
>      if not binary:
>          # The expected binary has not been found. Make sure we clean the
>          # install folder to remove any traces
> -        mozfile.remove(path)

The removal looks fine, but also get rid of the comment which does not apply anymore.
Attachment #8599638 - Flags: review?(hskupin) → feedback+
Attachment #8599638 - Attachment is obsolete: true
Attachment #8603731 - Flags: review+
Comment on attachment 8603731 [details] [diff] [review]
Updated comments when binary not found.

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

Thanks for the update. FYI r+ can only be set by a reviewer. You want to ask for review, so it will be the same as what I do now. I will have a look at it later.
Attachment #8603731 - Flags: review+ → review?(hskupin)
Comment on attachment 8603731 [details] [diff] [review]
Updated comments when binary not found.

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

This looks good. Parth, have you run the local unit tests for mozbase to ensure that your change in mozinstall didn't cause any other test to fail? You can find the runner in mozbase/test.py.
Attachment #8603731 - Flags: review?(hskupin) → review+
Flags: needinfo?(parthbakshi)
I have run all the tests, I did not see any errors.

python mozbase/test.py 
SUITE-START | Running 74 tests
...
TEST-PASS | test_apk.ApkTest.test_with_package_name | took 2ms
SUITE-END | took 111s
Flags: needinfo?(parthbakshi)
That's great. Thanks Parth! Given that the tests are passing I'm confident that we can land this patch without a try run. Thanks for your contribution and please let me know if there is something else you want to work on.
Target Milestone: --- → mozilla41
https://hg.mozilla.org/mozilla-central/rev/6800629ce1b1
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: