-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileDescriptor creation do not respect Group Write permissions #26
Comments
Weird. I opened #27 to ensure that we are properly mapping to the right At this point, it would be an issue with how the OS handles the |
This is how UNIX works and expected assuming that your This is also documented. See for example here
Darwin's
And here are the docs for the default umask:
|
If you want to actually want |
Well, this seems like pretty strong rationale to add
I would really like to avoid the very generic term "mode" if at all possible. If I didn't know the convention and the C IIUC, the argument is a requested file permissions, from which extension FilePermissions {
/// Set the process's file mode creation mask to `restricted`, which turns off
/// any present options during calls to `open`, `mkdir`, `mkfifo`, or `mknod`.
///
/// Returns the previous value of the file mode mask.
///
/// The corresponding C function is `umask`.
public static func setFileCreationMask(
removing restricted: FilePermissions
) -> FilePermissions {
FilePermissions(rawValue: umask(restricted.rawValue))
}
} If we had a
Is the argument that type type |
Hmm, I mean you're typically not supposed to ignore
Sounds good! What about setuid/setgid/sticky bit and friends though? They don't feel like permissions (to me) but can still be used in
Sort of, I think they are mostly subtracted but I think setuid/setgid also also typically subtracted on top. But the sticky bit usually isn't. I'm not sure anymore, has been a long time since I looked into that but the bottom line is that I think there is extra magic going on in the kernel after subtracting umask.
Nope, you'd need to do
.
Yes, definitely feels better on
Good question if I'm arguing that or not. But the "sticky bit" or setuid/gid don't feel like "permissions" to me but maybe you could see them as such. For posterity, here are the docs for
No idea what the sticky bit does on non-directories, if anything :). But yeah, the sticky bit is more like an anti-permission rather than a permission IYSWIM. |
The fact that we cannot atomically fetch extension FilePermissions {
/// The default process-wide file mode creation mask,, which turns off
/// any present options during calls to `open`, `mkdir`, `mkfifo`, or `mknod`.
///
/// The file mode creation mask can be changed with (TODO: `setFileCreationMask` or `umask`?)
///
/// The corresponding C function is `umask`.
public static var defaultFileCreationMask: FilePermissions {
FilePermissions(rawValue: 0o22)
}
} Since it's not affecting anything, a static member on
Hmm. From first principals, we want a I don't think the name The best opportunity or argument we may have for a rename would be with Window support. @compnerd, comments on this? IIUC, Windows has file attributes ( When we get around to providing Rust went with |
System calls its version of There is no expectation that |
|
When open file descriptor for write and set option
.create
created file does not have group write permission. Checked with all group permissions.groupWrite
,.groupReadWrite
,.groupReadWriteExecute
In case below, expect to have permissions
0020
, but get0000
System: MacOS 10.15.7
Swift toolchain: Swift Development Snapshot 2021-02-16
SwiftPackage revision
2e9c1a71185c828416751283b40697725da550b6
The text was updated successfully, but these errors were encountered: