Skip to content

Update os.open to preserve mode= for certain edge cases. #210

@jahrules

Description

@jahrules

Creating this new "issue" to better filter the discussion.

Originally posted by @TheMatt2 in #204 (comment)

Albeit, before this commit, the prior solution was not thread-safe which is not any better.
And you are right that so long as os.umask() is a reasonable value, there is no issue.

Before this change (I mean before the multi-user locks) you are right that setting os.umask(0) would give the locks 0o777 perms. The difference is, now that there is an explicit mode argument, there is now a situation where a user may think the lock will be securely and properly held, but then has an issue due to this moment between file creation and permission set.

However, I think that 0.1% case can be covered by passing self._mode to os.open() as well.
Just because its not "common" doesn't make it unimportant.

Perhaps this is better as a separate PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions