-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 04/25/2014 02:08 PM, Zack Weinberg wrote: > Bug 961080 asks for the new download manager to "support group and > world-writable umasks for downloaded files". It is stalled on a > design disagreement between me and the OS.File maintainers (well, > it is also stalled because my development box corrupts its > filesystem when I do 'hg pull -u', but that's not important right > now) which I would like to raise for discussion here.
I think the earlier thread has wandered off into the weeds a bit. Let's focus back in on new APIs for permission management in OS.File. (This is now bug 1001849.) > | setPerms([path,] mode) - set the Unix file access permissions to > a | specific numeric mode. Throws an exception if called on > Windows. | | makeAccessibleByOthers([path,] exec) - Adjust file > access permissions | to make the file accessible by others, > honoring any relevant | system configuration about that. If > 'exec' is true, make the | file executable, otherwise don't. On > Unix, that's | | chmod(path, (exec ? 0777 : 0666) & > ~umask); | | On Windows, currently does nothing. I suspect > there is | something useful it could do on Windows, but I don't > know | what it is. Based on all discussion to this point, I'm proposing this low-level API: fileObject.setPermissions(options); OS.File.setPermissions(path, options); where 'options' is a dictionary, initially supporting only { posixMode: "nnn", // mandatory applyUmask: (true|false) // optional, default false } "nnn" can be either a number or a string; if it's a string, it is run through parseInt(, 8) first (this is to work around the lack of octal literals in Javascript anymore). This API will be available on all platforms but initially will do nothing on Windows. I will file a bug for "make this do something useful on Windows" and someone who actually understands Windows file permissions will need to take over from there. I am also proposing this high-level API: fileObject.normalizePermissions([options]) OS.File.normalizePermissions(path[, options]) with no options initially defined (i.e. pass nothing or an empty dictionary). On POSIXy systems this will have the effect of chmod(file, 0666 & ~umask); on Windows, again, it will do nothing, and someone who understands Windows file permissions can make it do something useful later. We can also worry about whether it should (attempt to) adjust group ownership later. I would like to get this done and baked as soon as possible so it can be uplifted to ESR31, so please let's stay focused this time. zw -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iQIcBAEBCAAGBQJTXpNhAAoJEJH8wytnaapkZbgP/RVQb0n7hmMS3TLLrcp0AQGK UpJWRxmUIwjuGCv9N5t6d25jSbNcRSZW4yY7LSstjIc+388qeB5/82Fg1r5o4UbQ HlSfQCy1QIXsqqr06L8aXDa/L2Ta3/029ytyuqS6KeWLBxT7lPz0Dmq5aexfjtsp 2ZH2I/VPBLwM2HPzWxwn6UZbh8oIaZrW0VyOLEFBVRhPxtvC56uGkEO3cIb5Cxti PYwkrtSLeNO2WRMix8vKXypN5reqSD5CKOFQ9p2s11vBBCCmp70L+CfFTIU5U5ZT YAgZHZ5DaqROaYsSyQexsKNTp82qebfZCzq4064a2s0Nt63aAsC2m7VrfkvabHLi ahMj9mEhtaoG/mEKF2+ThYmF9BYuFhF+cxnG4yyxyLu4eMscFwIhnkkV35n4mYrD 5wE2j30hgHi3cajzTTYn+GpgwCCfEJpms+wOy1QgBTG+qUqXKqKMMn6/2GxpqPJP b6AvYkU9SauXxjCERqgFYbaNms1uIy8dtfkcTOg/FM4On87zfgHDHrhFEeXkm8t7 PrtpyavObj1Smw0goh4S4Y2rHnLYMi4r1Vh1r5MBhXSSf10InbR5t+/NzlIOkzDE gQZhDCJ+uz8IJb9wFMa2DzYHJZY2Sqghlj8dsERkgKZeaSpJKBoqiPPldlr5a4lW YImNW00l3TIQFLLuWazs =nbMg -----END PGP SIGNATURE----- _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform