Page MenuHomePhabricator

Don't create directories as `0777` by default.
ClosedPublic

Authored by joshuaspence on Jun 17 2014, 2:59 AM.
Tags
None
Referenced Files
F13959476: D9594.id.diff
Mon, Oct 14, 7:35 PM
Unknown Object (File)
Sat, Oct 12, 10:22 PM
Unknown Object (File)
Aug 31 2024, 10:58 PM
Unknown Object (File)
Aug 31 2024, 9:14 AM
Unknown Object (File)
Aug 31 2024, 4:22 AM
Unknown Object (File)
Aug 31 2024, 1:51 AM
Unknown Object (File)
Aug 21 2024, 1:17 AM
Unknown Object (File)
Aug 19 2024, 9:58 AM
Subscribers

Details

Summary

Currently, Filesystem::createDirectory('...') will create a directory with (rather open) 0777 permissions (regardless of the return value of umask()). In particular, the .git/arc directory (or similar directory for another VCS) will have 0777 permissions.

Test Plan

Removed the .git/arc directory and ran arc lint. Verified that the .git/arc directory had more restrictive permissions than 0777.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Don't create directories as `0777` by default..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

I don't think we should trust the system umask. This will lead to inexplicable failure if the umask is set incorrectly.

How about defaulting to mode 0755 (equivalent to umask 0022) instead?

(Or, is there any reason that a system might reasonably have a different umask and want it preserved?)

I think supporting null to mean "trust system umask" is also reasonable, but that this shouldn't be the default.

joshuaspence edited edge metadata.
  • Create directories as 0755 by default.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Jun 17 2014, 4:53 PM