Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replace use of mktemp #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Byron merged 1 commit into gitpython-developers:master from EliahKagan:no-mktemp
Dec 13, 2023
Merged

Conversation

Copy link
Member

@EliahKagan EliahKagan commented Dec 13, 2023
edited
Loading

Fixes #41

This uses NamedTemporaryFile with delete=False to replace the one use of the deprecated mktemp function in smmap (reported in #41).

This avoids the race condition inherent to mktemp, as the file is named and created together in a way that is effectively atomic.

Because NamedTemporaryFile is not being used to automatically delete the file, it use and cleanup are unaffected by the change.

(This PR is conceptually related to gitpython-developers/GitPython#1770.)

This uses NamedTemporaryFile with delete=False to replace the one
use of the deprecated mktemp function in smmap (reported in gitpython-developers#41).
This avoids the race condition inherent to mktemp, as the file is
named and created together in a way that is effectively atomic.
Because NamedTemporaryFile is not being used to automatically
delete the file, it use and cleanup are unaffected by the change.
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

EliahKagan reacted with thumbs up emoji
@Byron Byron merged commit 04dd210 into gitpython-developers:master Dec 13, 2023
@EliahKagan EliahKagan deleted the no-mktemp branch December 13, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Byron Byron Byron approved these changes

Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Don't use mktemp
2 participants

AltStyle によって変換されたページ (->オリジナル) /