tempfile icon indicating copy to clipboard operation
tempfile copied to clipboard

Restore default permissions on persist (on Unix)

Open tbu- opened this issue 7 years ago • 3 comments

Like #2 and #3, it would be nice to get a normal file after calling persist on a NamedTemporaryFile. NamedTemporaryFile is opened with 0o600, I'd expect to get a 0o644 file after that.

tbu- avatar Jul 21 '17 19:07 tbu-

I'd probably use libc::umask to determine the correct permissions but that sounds like a good idea.

Stebalien avatar Jul 21 '17 19:07 Stebalien

Actually, this is a bit tricky. What if the user changes the file mode while it's a temporary file?

Stebalien avatar Jul 24 '17 07:07 Stebalien

The same could be said for the attributes in #2 or #3.

Hmm. Maybe add a function that tells tempfile to not mess with the file when persisting?

tbu- avatar Jul 24 '17 10:07 tbu-

It's now possible to configure the permissions when creating a temporary file.

Stebalien avatar Feb 05 '24 18:02 Stebalien

Thank you very much @Byron and @Stebalien! This fixes a long-standing problem I had. :)

tbu- avatar Feb 05 '24 21:02 tbu-