Closed Bug 775708 Opened 12 years ago Closed 12 years ago

A better mechanism of determining if you have root on device

Categories

(Testing :: Mozbase, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: onecyrenus, Assigned: onecyrenus)

References

Details

Attachments

(1 file)

Current method is to listFiles in /data/data to determine if we have root on the device. 

I think we can do this using adb shell "id" command to get the guid / uid of the current user ?
Blocks: 771725
Component: Mochitest → Mozbase
Attachment #643981 - Attachment is patch: true
Attachment #643981 - Flags: review?(jmaher)
The problem with the existing method is that /data/data is empty on B2G, so devicemanager never recognizes that we are running as root.
Comment on attachment 643981 [details] [diff] [review]
A patch that checks the guid / uid of the current user to determine if they are root on the device

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

::: build/mobile/devicemanagerADB.py
@@ +808,5 @@
> +    response = p.stdout.readline()
> +    response = response.rstrip()
> +    response = response.split(' ')
> +    if (response[0].find('uid=0') < 0 or response[1].find('gid=0') < 0):
> +      print "NOT running as root ", response[0].find('uid=0')

do we want to raise a DMError here?
Attachment #643981 - Flags: review?(jmaher) → review+
posted to try, just in case
try ate my last submission, tried again:  https://tbpl.mozilla.org/?tree=Try&rev=190945a1d0e7
Try run for 190945a1d0e7 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=190945a1d0e7
Results (out of 29 total builds):
    exception: 8
    success: 16
    warnings: 4
    failure: 1
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/jgriffin@mozilla.com-190945a1d0e7
http://hg.mozilla.org/mozilla-central/rev/f91c1b55b396
Assignee: nobody → dclarke
Target Milestone: --- → mozilla17
https://hg.mozilla.org/mozilla-central/rev/2bfd0b750bb1
Status: NEW → RESOLVED
Closed: 12 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: