-
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
fs::File::create() on Unix should use 0666 mode by default. #22174
Comments
There is no direct equivalent in C. However, it doesn't seem a good idea to give a |
I don't understand why you think my C code is not equivalent. Let me cite "man 3 fopen":
About forcing the user to set permission ( |
Yes I think that this change was just carried over from the previous implementation. The relevant line to change would be this one and I think it's fine to make the change. |
Then I change it. |
Fixed in #22186 |
Compare the output of this rust code
with the C equivalent:
or the C++ one:
The output of these programs is:
The C and C++ versions will create a file with mode 0666 (minus the umask, mine is 0022). But the Rust one is different: 0600.
Given the Principle of Least Surprise, I think that the default mode should be changed from 0600 to 0666.
The text was updated successfully, but these errors were encountered: