{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiarpus3te7nhesjh4qvf4sxov3ubcna7pabv555sp722vhge7ikty",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mgznyee3p622"
  },
  "path": "/t/idea-add-an-option-to-set-the-mode-to-fs-copy/24080#post_1",
  "publishedAt": "2026-03-14T11:35:28.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "fs::copy",
    "this"
  ],
  "textContent": "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.\n\nThe 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).\n\nWhat 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.",
  "title": "Idea: Add an option to set the mode to fs::copy"
}