Closed
Description
Compare the output of this rust code
fn main() {
std::fs::File::create("test1.txt");
}
with the C equivalent:
int main() { fopen("test2.txt", "w"); }
or the C++ one:
#include <fstream>
int main() { std::ofstream f("test3.txt"); }
The output of these programs is:
$ (compile & run)
$ ls -l test?.txt
-rw------- 1 rodrigo rodrigo 0 Feb 11 12:00 test1.txt
-rw-r--r-- 1 rodrigo rodrigo 0 Feb 11 12:00 test2.txt
-rw-r--r-- 1 rodrigo rodrigo 0 Feb 11 12:00 test3.txt
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.
Metadata
Metadata
Assignees
Labels
No labels