Idea: Add an option to set the mode to fs::copy
Rust Internals [Unofficial]
March 14, 2026
Currently in fs::copy, there is no way to set the mode of the file you are creating. This seems like something that would be quite intuitive to have, especially when building lower level utilities, and it also provides, perhaps at first hidden, security benefits.
The lack of an option to set a mode during copying has resulted in inelegant hacks like this (by yours truly) in software that needs to set file permissions before copying data over (to avoid permission races).
What do people think about this? I don't think it would be a very significant change, but I do think it could have quite positive effects on security.
Discussion in the ATmosphere