Closed Bug 715060 Opened 13 years ago Closed 13 years ago

devicemanagerADB pushDir fails on non-rooted device when unzipping to sdcard

Categories

(Testing :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla12

People

(Reporter: gbrown, Assigned: gbrown)

Details

Attachments

(1 file, 1 obsolete file)

Bug 701038 introduced the use of zip/unzip to devicemanagerADB.pushDir, to speed up pushes of large directories. If pushDir is used with zip/unzip on a device without privileged/root access, and the destination directory is on /sdcard, then unzip is likely to fail and abort because it cannot change the permissions on the destination files. 

For example, when pushing to /mnt/sdcard/tests/profile (for a mochitest-robotium test run), I see:

Archive:  /mnt/sdcard/tests/profile/adbdmtmp.zip
   creating: chrome/
unzip: can't set permissions of directory 'chrome/': Operation not permitted
unzip: exiting

The remaining files in the directory are not created.

I can find no way to override this behavior in the BusyBox unzip.

Since permissions are of no consequence to most tests, this failure is undesirable. pushDir without zip/unzip will also fail to set file permissions in this scenario, but all the files will still be pushed.
Attached patch patch to ADB pushDir (obsolete) — Splinter Review
This patch detects the unzip failure and then falls back to the normal pushDir behavior automatically: If unzip fails, devicemanager retries the pushDir without the zip/unzip.
Attachment #585647 - Flags: review?(jmaher)
Assignee: nobody → gbrown
:kats reported trouble running mochitest-robotium on an unrooted phone -- I suspect this patch will help him.
Comment on attachment 585647 [details] [diff] [review]
patch to ADB pushDir

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

r=me, just a couple nits below.

::: build/mobile/devicemanagerADB.py
@@ +120,5 @@
>          subprocess.check_output(["zip", "-r", localZip, '.'], cwd=localDir)
>          self.pushFile(localZip, remoteZip)
>          os.remove(localZip)
> +        data = self.runCmdAs(["shell", "unzip", "-o", remoteZip, "-d", remoteDir]).stdout.read()
> +        print data

do we need the 'print data' here?

@@ +125,4 @@
>          self.checkCmdAs(["shell", "rm", remoteZip])
> +        if (re.search("unzip: exiting", data) or re.search("Operation not permitted", data)):
> +          print "zip/unzip failure: falling back to normal push"
> +          self.useZip = False

do we need to set self.useZip here?  It is referenced above this.
Attachment #585647 - Flags: review?(jmaher) → review+
(In reply to Joel Maher (:jmaher) from comment #3)
> do we need the 'print data' here?

No - just being verbose. I will remove it.

> do we need to set self.useZip here?  It is referenced above this.

Yes - so that the recursive pushDir call does not use zip/unzip. Also, I want to not use zip/unzip on any additional pushDir's in the same instance -- if unzip fails once, I figure it's not worth checking again.
sounds good.  Upload a new patch and I can land it if you need me to.
Just removed extra print call. Carrying forward r+=jmaher.
Attachment #585647 - Attachment is obsolete: true
Attachment #585832 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1f35778a02a8
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: