-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add Permissions argument to create_dir{,_all} #22422
Add Permissions argument to create_dir{,_all} #22422
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
r? @aturon |
cc @alexcrichton -- was there any particular reason these were left out in the initial implementation? |
I actually intentionally left this out as I don't think we have any real concrete plans to expand |
We don't have immediate concrete plans right now, but the point of the design, as I understood it, was precisely to allow growing those over time. In other words, by keeping Put differently, We should implement |
e29cfae
to
a0e362a
Compare
Why is 0o777 the default? |
a0e362a
to
b0efee0
Compare
Would defaulting to |
There is no possible default value for permissions on linux. For directories you always want x but for files you almost never want x. |
f2c0faa
to
eb52aed
Compare
eb52aed
to
388a333
Compare
What is the status of this? This patch now only adds permissions to mkdir and nothing at all for windows. Furthermore there is no way to recursively create directories with permissions. This is such elementary functionality that is seems crazy that Rust 1.0 will ship without it. Combine this with the other issues that are popping up regarding the new io interface and it seems that radically changing io this short before stabilization was a mistake. If the normal create_dir_all ships without permissions then I guess in a few months you will add a new method create_dir_all2 that takes permissions. |
I’ll let somebody else to tackle this. I don’t want to have anything to do with anything related to Permissions any more. |
I'm sorry this was the outcome of the PR, but I'd be glad to take it over from here (or @alexcrichton may do so, since I'm on vacation right now.)
Last week we were focused on putting out alpha2, so this was explicitly put on hold (in communication with the PR author). As @alexcrichton explained, there has never been functionality in Rust for doing interesting things with permissions on Windows (and this is the case in many other std libraries as well). We intend to provide APIs for Windows permission manipulation, and perhaps eventually ones with real cross-platform semantics (that don't simply drop the permissions on the floor on Windows), but this will take time.
My preference is to provide
As we announced previously, the reason for launching alpha2 is precisely to have more time to stabilize the new IO APIs. The previous incarnation of IO had myriad known problems, and by and large the changes have moved things in a more conservative direction. |
Fixes #22415