This patch changes fs::setPermissions to optionally set permissions while respecting the umask. It also adds the function fs::getUmask() which returns the current umask.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This change is not 100% necessary it doesn't need to be in lib/Support, but I am planning on using it for D62718. I figured I would test the waters on this one. Also, fs::getUmask() isn't necessary to have, I think that the change to fs::setPermissions would be enough, but I figured I would add it and remove later than the other way around.
llvm/lib/Support/Windows/Path.inc | ||
---|---|---|
741 ↗ | (On Diff #205720) | I don't know if unnamed parameters are allowed per the style guide, it isn't used by the Windows version of this function, this was the thinking behind this. |
Updated doxygen comments for fs::setPermissions to explain new RespectUmask parameter.
I've added a couple of other reviewers who have made recent changes to the Path files.
llvm/lib/Support/Unix/Path.inc | ||
---|---|---|
695–698 ↗ | (On Diff #205723) | It's not your fault, but this dance seems ridiculous. |
702 ↗ | (On Diff #205723) | clang-format? |
709 ↗ | (On Diff #205723) | Remove double-blank line. |
llvm/lib/Support/Windows/Path.inc | ||
741 ↗ | (On Diff #205720) | clang-format. I think this is fine. |
llvm/unittests/Support/Path.cpp | ||
1541 ↗ | (On Diff #205723) | You're capitalization of test names is inconsistent. One starts with a leading caps, and the other doesn't. |
1555 ↗ | (On Diff #205723) | I think you also need a test case for explicit false for respectUmask. |
llvm/lib/Support/Unix/Path.inc | ||
---|---|---|
695–698 ↗ | (On Diff #205723) | Agreed, there are quite a few get/set syscalls, not sure why this needed to be the case for umask. |
702 ↗ | (On Diff #205723) | Yup sorry about that I should have looked over git clang-formats changes. It did not format the .inc files. This should be proper formatting now, I just copied how it is in the header file which clang-format did. |
llvm/unittests/Support/Path.cpp | ||
1541 ↗ | (On Diff #205723) | I think this is consistent with the rest of the file. getUmask is capitalized as such because it is testing a specific function, while RespectUmask is testing behavior. is_local test versus the ReadWriteFileCanReadOrWrite test. |
LGTM. Maybe give it a couple of days before committing for a chance for others to say something.