[mozrunner] Device.cleanup changes file ownership and permissions when restoring backed-up files like profiles.ini

NEW
Unassigned

Status

defect
P5
normal
3 years ago
2 years ago

People

(Reporter: maja_zf, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

I encountered this when I tried to run Fennec in an emulator via mach (`./mach android-emulator; ./mach run`) after having run Fennec in an emulator using mozrunner.FennecEmulatorRunner. 

The difference between the two is that `./mach run` uses mozrunner/devices/android_device.py, whereas FennecEmulatorRunner uses mozrunner's Device class. 

As part of closing Fennec and the emulator, Device.cleanup [1] copies the original profiles.ini back onto the emulator, but the "restored" file is owned by root instead of "u0_a43", for example. If you then try to run Fennec on the emulator via mach, you see a start-up crash because of a permission-denied error when the browser needs to update profiles.ini.

From logcat:
```
D/GeckoProfile(  658): Created new profile dir.
D/Telemetry(  658): StartUISession: firstrun.1
W/System.err(  658): java.io.FileNotFoundException: /data/data/org.mozilla.fennec/files/mozilla/profiles.ini: open failed: EACCES (Permission denied)
```

[1] https://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozrunner/mozrunner/devices/base.py#250-252
Summary: [mozrunner] Device.cleanup changes file ownership and permissions when restoring backed-up files l like profiles.ini → [mozrunner] Device.cleanup changes file ownership and permissions when restoring backed-up files like profiles.ini
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.