Stebalien / tempfile

Temporary file library for rust
http://stebalien.com/projects/tempfile-rs
Apache License 2.0
1.15k stars 113 forks source link

Builder Permissions not setting universal access #295

Closed lancelui-amzn closed 1 month ago

lancelui-amzn commented 1 month ago

I am trying to set permissions for the temp folder as 0o777, but Builder::permissions sets it to 0o755. Can it not set write permissions? Currently using fs::set_permissions to do so as a work around.

On tempfile version 3.12.0 with Amazon Linux 2.

playground demonstration

Stebalien commented 1 month ago

It obeys the umask, which is unavoidable (without an additional call to chmod) but should definitely be better documented. I.e., when you set 0o777, you get 0o777 & ~0o022 (assuming your umask is the default 0o022).

Stebalien commented 1 month ago

Hm. Actually, I think it should obey the umask but we have a test that disagrees. Let me look at that.

Stebalien commented 1 month ago

Ah, nvm. I misread the test. Yeah, it'll obey the umask and there's not much we can do about it (other than explicitly calling fs::set_permissions ourselves).

See https://docs.rs/tempfile/latest/tempfile/struct.Builder.html#unix