tempfile
tempfile copied to clipboard
File persisted with 600 permissions
I have noticed that the permission of a persisted NamedTempFile
is 600, but I was expecting it to be 644 (default permissions when creating a file).
I could be mistaken, but i found no mention of that in the doc? Maybe this could be part of the persist documentation?
I can issue a PR if needed.
More documentation would definitely be helpful. Specifically:
- We need documentation on
NamedTempFile::new
explaining the default mode. - We need documentation on
Builder
explaining the defaults. - We need documentation on
persist
stating that it leaves the mode as-is (e.g., defaults to 600).
Unfortunately, I can't think of a good way to actually change this behavior:
- We assume that the tempfile directory may be shared, so we create files with 600.
- If we change the mode after persisting, the operation wouldn't be atomic, which may cause even harder to track down issues.
Ideally, we'd, provide a way to set the default mode in the Builder
. There was a patch to do this, but, IIRC, it wasn't cross platform.
@Stebalien do you know where to find said patch? Perhaps there's a way to make it cross-platform.
@assarbad https://github.com/Stebalien/tempfile/pull/61
We can now set default permissions (Builder::permissions
), so I'll consider this fixed.