Closed
Bug 804563
Opened 13 years ago
Closed 7 years ago
nsIFile's createUnique() with 'other' permissions doesn't work
Categories
(Core Graveyard :: Widget: Gonk, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: mdas, Unassigned)
Details
If you create a file using createUnique() within the chrome context of a root app like system, and you want to give access to other users, the permission bits don't actually get set. If you do:
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("TmpD", ["suggestedName.tmp"]);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0777", 8));
the file only gets -rwxr-x--- permissions. To set the permissions correctly, you have to get the nsIFile and alter its permissions attribute.
If you have marionette enabled on your build (any 'eng' build in releases.mozilla.com/b2g has marionette enabled), you can test this by using the marionette client. In a terminal, do 'adb forward tcp:2828 tcp:2828' and then set up the python virtual environment (https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Setting_Up_Marionette_for_B2G#In_a_Virtual_Environment). Then in python:
from marionette import Marionette
m = Marionette()
m.start_session()
m.set_context("chrome")
m.execute_script('Components.utils.import("resource://gre/modules/FileUtils.jsm");var file = FileUtils.getFile("TmpD", ["suggestedName.tmp"]);file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("777", 8));return file.path;')
Then look at the permissions of the returned file.
Comment 1•7 years ago
|
||
Closing as we are not working on Firefox OS anymore.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Updated•7 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•